diff options
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1,4 +1,5 @@ #define _XOPEN_SOURCE 600 +#define _GNU_SOURCE #include "util.h" #include "tui.h" @@ -40,6 +41,21 @@ done: return width; } +const wchar_t * +wcscasestr(const wchar_t *haystack, const wchar_t *needle) +{ + int hslen, nlen, i; + + nlen = wcslen(needle); + hslen = wcslen(haystack) - nlen; + for (i = 0; i < hslen; i++) { + if (!wcsncasecmp(haystack + i, needle, nlen)) + return haystack + i; + } + + return NULL; +} + void panic(const char *file, int line, const char *msg, ...) { |
