summaryrefslogtreecommitdiff
path: root/misc/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'misc/util.h')
-rw-r--r--misc/util.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/misc/util.h b/misc/util.h
index e9bc4f3..b71a8ea 100644
--- a/misc/util.h
+++ b/misc/util.h
@@ -14,8 +14,9 @@
#ifndef MISC_UTIL_H
#define MISC_UTIL_H
-#include <stdio.h>
+#include <stdbool.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
@@ -63,4 +64,10 @@
#define unsupported(s) \
fprintf(stderr, __FILE__ ":%d: unsupported: " s "\n", __LINE__)
+
+static inline bool strbegins(const char *s, const char *prefix)
+{
+ return !strncmp(s, prefix, strlen(prefix));
+}
+
#endif /* !MISC_UTIL_H */