summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorEric Andersen2001-03-08 23:59:45 +0000
committerEric Andersen2001-03-08 23:59:45 +0000
commit13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb (patch)
tree2facfcfcd614fe7d935e167820f202e739196bc0 /utility.c
parentdf351d6109fb1846e5d18fa89e91ee050a7de334 (diff)
downloadbusybox-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.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index 7fd4cad..b4893a0 100644
--- a/utility.c
+++ b/utility.c
@@ -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: