diff options
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -26,6 +26,7 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> +#include <ctype.h> #include <sys/param.h> #include "util.h" @@ -138,4 +139,19 @@ void Debug(const char *format, ...) va_end(ap); } + +int StartsWith(const char *a, const char *b, size_t len) +{ + while(len && *a && *b && + tolower((unsigned char)*a) == tolower((unsigned char)*b)) + { + len--; + a++; + b++; + } + + return len == 0; +} + + /* END OF FILE */ |
