summaryrefslogtreecommitdiff
path: root/libbb/trim.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/trim.c')
-rw-r--r--libbb/trim.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libbb/trim.c b/libbb/trim.c
index d363915..4957d72 100644
--- a/libbb/trim.c
+++ b/libbb/trim.c
@@ -8,12 +8,8 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
#include "libbb.h"
-
void trim(char *s)
{
size_t len = strlen(s);
@@ -23,9 +19,9 @@ void trim(char *s)
while (len && isspace(s[len-1])) --len;
/* trim leading whitespace */
- if(len) {
+ if (len) {
lws = strspn(s, " \n\r\t\v");
memmove(s, s + lws, len -= lws);
}
- s[len] = 0;
+ s[len] = '\0';
}