skip leading whitespace; remove trailing whitespace, in place */
| 161 | |
| 162 | /* skip leading whitespace; remove trailing whitespace, in place */ |
| 163 | char * |
| 164 | trimspaces(char *txt) |
| 165 | { |
| 166 | char *end; |
| 167 | |
| 168 | /* leading whitespace will remain in the buffer */ |
| 169 | while (*txt == ' ' || *txt == '\t') |
| 170 | txt++; |
| 171 | end = eos(txt); |
| 172 | while (--end >= txt && (*end == ' ' || *end == '\t')) |
| 173 | *end = '\0'; |
| 174 | |
| 175 | return txt; |
| 176 | } |
| 177 | |
| 178 | /* remove \n from end of line; remove \r too if one is there */ |
| 179 | char * |
no test coverage detected