@@ -67,6 +67,14 @@ STRCASESTR (const char *haystack, const char *needle)
/* Handle empty NEEDLE special case. */
if (needle[0] == '\0')
return (char *) haystack;
+ if (isalpha(*needle)) {
+ const char a[] = { tolower(*needle), toupper(*needle), '\0'};
+ haystack = strpbrk(haystack, a);
+ } else {
+ haystack = strchr(haystack, *needle);
+ }
+ if (haystack == NULL || needle[1] == '\0')
+ return (char *)haystack;
/* Ensure HAYSTACK length is at least as long as NEEDLE length.
Since a match may occur early on in a huge HAYSTACK, use strnlen