/* * strcasestr() - Case insensitive search for string b * inside of string a. * * Dan Cross */ #include #include #include char * strcasestr(char *a, char *b) { size_t l; char t[3]; t[0] = tolower(*b); t[1] = toupper(*b); t[2] = '\0'; for (l = strcspn(a, t); l != strlen(a); l += strcspn(a + l, t)) { if (strncasecmp(a + l, b, strlen(b)) == 0) { return(a + l); } l++; } return(NULL); }