aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Whitley <markw@lineo.com>2001-03-09 00:55:34 +0000
committerMark Whitley <markw@lineo.com>2001-03-09 00:55:34 +0000
commitafffbfe8c47ddec718952128dd517898c8bf36cd (patch)
treed405af09fa039f54f7b3d792ba33ad0c4cfddc1a
parentb180dd9e50ec3ccdd702c9467cedebd3d9972432 (diff)
downloadbusybox-w32-afffbfe8c47ddec718952128dd517898c8bf36cd.tar.gz
busybox-w32-afffbfe8c47ddec718952128dd517898c8bf36cd.tar.bz2
busybox-w32-afffbfe8c47ddec718952128dd517898c8bf36cd.zip
Fix to trim to make it trim properly.
-rw-r--r--utility.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/utility.c b/utility.c
index b4893a0e1..092cfdb10 100644
--- a/utility.c
+++ b/utility.c
@@ -1831,13 +1831,13 @@ void chomp(char *s)
1831#if defined(BB_SH) 1831#if defined(BB_SH)
1832void trim(char *s) 1832void 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