aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-09 00:55:34 +0000
committermarkw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-09 00:55:34 +0000
commit71ae45f48a484426097a134801c9976fd36f5110 (patch)
treed405af09fa039f54f7b3d792ba33ad0c4cfddc1a
parentd990108a7ab7bd9c647892813c34ee04c57655bc (diff)
downloadbusybox-w32-71ae45f48a484426097a134801c9976fd36f5110.tar.gz
busybox-w32-71ae45f48a484426097a134801c9976fd36f5110.tar.bz2
busybox-w32-71ae45f48a484426097a134801c9976fd36f5110.zip
Fix to trim to make it trim properly.
git-svn-id: svn://busybox.net/trunk/busybox@2017 69ca8d6d-28ef-0310-b511-8ec308f3f277
-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