summaryrefslogtreecommitdiffstats
path: root/include/strutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/strutils.h')
-rw-r--r--include/strutils.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/strutils.h b/include/strutils.h
index c7fe42a63..3883b4288 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -5,6 +5,7 @@
#include <inttypes.h>
#include <string.h>
#include <sys/types.h>
+#include <ctype.h>
/* default strtoxx_or_err() exit code */
#ifndef STRTOXX_EXIT_CODE
@@ -143,4 +144,21 @@ static inline const char *endswith(const char *s, const char *postfix)
return (char *)s + sl - pl;
}
+/*
+ * Skip leading white space.
+ */
+static inline const char *skip_space(const char *p)
+{
+ while (isspace(*p))
+ ++p;
+ return p;
+}
+
+static inline const char *skip_blank(const char *p)
+{
+ while (isblank(*p))
+ ++p;
+ return p;
+}
+
#endif