/* ISC license. */ #include #ifdef SKALIBS_HASSTRCASESTR #include #include #include size_t case_str (char const *haystack, char const *needle) { register char *p = strcasestr(haystack, needle) ; return p ? p - haystack : strlen(haystack) ; } #else #include #include #include size_t case_str (char const *haystack, char const *needle) { size_t nlen = strlen(needle) ; char const *p = haystack ; if (!nlen) return 0 ; for (; *p ; p++) if (!strncasecmp(p, needle, nlen)) return p - haystack ; return strlen(haystack) ; } #endif