aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/util.c b/util.c
index 6e6079e..14dfeaa 100644
--- a/util.c
+++ b/util.c
@@ -2,6 +2,7 @@
#include <string.h>
#include <errno.h>
#include <linux/limits.h>
+#include <ctype.h>
#include "util.h"
@@ -31,3 +32,14 @@ int r_mkdir(const char *path, mode_t mode)
return mkdir(path, mode);
}
+
+void util_strtrim(char *s)
+{
+ char *rend;
+
+ for (rend = s; *s; ++s)
+ if (!isspace(*s))
+ rend = s;
+
+ rend[1] = '\0';
+}