diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-03-08 23:59:45 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-03-08 23:59:45 +0000 |
commit | 13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb (patch) | |
tree | 2facfcfcd614fe7d935e167820f202e739196bc0 /utility.c | |
parent | df351d6109fb1846e5d18fa89e91ee050a7de334 (diff) | |
download | busybox-w32-13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb.tar.gz busybox-w32-13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb.tar.bz2 busybox-w32-13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb.zip |
Add in 'trim' routine. Fix up sh.c so it works when wordexp
is not available.
-Erik
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1828,6 +1828,19 @@ void chomp(char *s) | |||
1828 | } | 1828 | } |
1829 | #endif | 1829 | #endif |
1830 | 1830 | ||
1831 | #if defined(BB_SH) | ||
1832 | void trim(char *s) | ||
1833 | { | ||
1834 | /* trim leading whitespace */ | ||
1835 | memmove(s, &s[strspn(s, " \n\r\t\v")], strlen(s)); | ||
1836 | |||
1837 | /* trim trailing whitespace */ | ||
1838 | while (*s && (!isspace (*s))) | ||
1839 | s++; | ||
1840 | *s='\0'; | ||
1841 | } | ||
1842 | #endif | ||
1843 | |||
1831 | /* END CODE */ | 1844 | /* END CODE */ |
1832 | /* | 1845 | /* |
1833 | Local Variables: | 1846 | Local Variables: |