Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-03-09 02:59:45 +0300
committerEric Andersen <andersen@codepoet.org>2001-03-09 02:59:45 +0300
commit13d1fa1d01e48c7a23cc1114fc4d45b20f2c48eb (patch)
tree2facfcfcd614fe7d935e167820f202e739196bc0 /utility.c
parentdf351d6109fb1846e5d18fa89e91ee050a7de334 (diff)
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 7fd4cad7d..b4893a0e1 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: