diff options
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c index c7dc61c..ec5a1ea 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1602,3 +1602,15 @@ asprintf(char **str, const char *format, ...) return n; } + +int starts_with(const char *s, const char *p) +{ + for (; *p && *p == *s; s++, p++); + return (*p == '\0'); +} + +int starts_with_ci(const char *s, const char *p) +{ + for (; *p && tolower(*p) == tolower(*s); s++, p++); + return (*p == '\0'); +} |