From fe6d3a9e8504da158b00ed44ceeae54f6b96dfc4 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 22 Aug 2016 21:24:42 -0300 Subject: [PATCH] eeshow/misc/util.h (strbegins): !strncmp(s, prefix, strlen(prefix)) --- eeshow/misc/util.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/eeshow/misc/util.h b/eeshow/misc/util.h index e9bc4f3..b71a8ea 100644 --- a/eeshow/misc/util.h +++ b/eeshow/misc/util.h @@ -14,8 +14,9 @@ #ifndef MISC_UTIL_H #define MISC_UTIL_H -#include +#include #include +#include #include @@ -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 */