aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
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: