summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-23 00:24:42 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-08-23 00:25:28 (GMT)
commit2367b4801413e9b9ef5676e52cdfec9fe70455f7 (patch)
tree5e68d83954a8d69b85d241ac462a3082d5ec3a45 /misc
parentce690a463d1905b2aba8a04c29a248af66153681 (diff)
downloadeeshow-2367b4801413e9b9ef5676e52cdfec9fe70455f7.zip
eeshow-2367b4801413e9b9ef5676e52cdfec9fe70455f7.tar.gz
eeshow-2367b4801413e9b9ef5676e52cdfec9fe70455f7.tar.bz2
eeshow/misc/util.h (strbegins): !strncmp(s, prefix, strlen(prefix))
Diffstat (limited to 'misc')
-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 */