diff options
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: |