comparison utils.c @ 20:40748b097655

add output.
author David A. Holland
date Mon, 20 Dec 2010 04:03:35 -0500
parents c08a947d8f30
children b156910b59b2
comparison
equal deleted inserted replaced
19:f9792a9ec704 20:40748b097655
106 strcat(ret, t); 106 strcat(ret, t);
107 strcat(ret, u); 107 strcat(ret, u);
108 return ret; 108 return ret;
109 } 109 }
110 110
111 char *
112 dostrndup(const char *s, size_t len)
113 {
114 char *ret;
115
116 ret = domalloc(len+1);
117 memcpy(ret, s, len);
118 ret[len] = '\0';
119 return ret;
120 }
121
111 size_t 122 size_t
112 notrailingws(char *buf, size_t len) 123 notrailingws(char *buf, size_t len)
113 { 124 {
114 while (len > 0 && strchr(ws, buf[len-1])) { 125 while (len > 0 && strchr(ws, buf[len-1])) {
115 buf[--len] = '\0'; 126 buf[--len] = '\0';