diff options
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) | |||
1831 | #if defined(BB_SH) | 1831 | #if defined(BB_SH) |
1832 | void trim(char *s) | 1832 | void trim(char *s) |
1833 | { | 1833 | { |
1834 | /* trim trailing whitespace */ | ||
1835 | while (isspace(s[strlen(s)-1])) | ||
1836 | s[strlen(s)-1]='\0'; | ||
1837 | |||
1834 | /* trim leading whitespace */ | 1838 | /* trim leading whitespace */ |
1835 | memmove(s, &s[strspn(s, " \n\r\t\v")], strlen(s)); | 1839 | memmove(s, &s[strspn(s, " \n\r\t\v")], strlen(s)); |
1836 | 1840 | ||
1837 | /* trim trailing whitespace */ | ||
1838 | while (*s && (!isspace (*s))) | ||
1839 | s++; | ||
1840 | *s='\0'; | ||
1841 | } | 1841 | } |
1842 | #endif | 1842 | #endif |
1843 | 1843 | ||