diff options
author | Mark Whitley | 2001-03-09 00:55:34 +0000 |
---|---|---|
committer | Mark Whitley | 2001-03-09 00:55:34 +0000 |
commit | afffbfe8c47ddec718952128dd517898c8bf36cd (patch) | |
tree | d405af09fa039f54f7b3d792ba33ad0c4cfddc1a /utility.c | |
parent | b180dd9e50ec3ccdd702c9467cedebd3d9972432 (diff) | |
download | busybox-afffbfe8c47ddec718952128dd517898c8bf36cd.zip busybox-afffbfe8c47ddec718952128dd517898c8bf36cd.tar.gz |
Fix to trim to make it trim properly.
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1831,13 +1831,13 @@ void chomp(char *s) #if defined(BB_SH) void trim(char *s) { + /* trim trailing whitespace */ + while (isspace(s[strlen(s)-1])) + s[strlen(s)-1]='\0'; + /* trim leading whitespace */ memmove(s, &s[strspn(s, " \n\r\t\v")], strlen(s)); - /* trim trailing whitespace */ - while (*s && (!isspace (*s))) - s++; - *s='\0'; } #endif |