diff options
author | Eric Andersen | 2001-03-08 23:59:45 +0000 |
---|---|---|
committer | Eric Andersen | 2001-03-08 23:59:45 +0000 |
commit | 13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb (patch) | |
tree | 2facfcfcd614fe7d935e167820f202e739196bc0 /utility.c | |
parent | df351d6109fb1846e5d18fa89e91ee050a7de334 (diff) | |
download | busybox-13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb.zip busybox-13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb.tar.gz |
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) } #endif +#if defined(BB_SH) +void trim(char *s) +{ + /* 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 + /* END CODE */ /* Local Variables: |