acl/app/jaws/global/string.c

26 lines
430 B
C

#include <ctype.h>
#include "string_patch.h"
#ifdef HAVE_NO_STRCASESTR
char *strcasestr(char *haystack, char *needle)
{
char *p, *startn = 0, *np = 0;
for (p = haystack; *p; p++) {
if (np) {
if (toupper(*p) == toupper(*np)) {
if (!*++np)
return startn;
} else
np = 0;
} else if (toupper(*p) == toupper(*needle)) {
np = needle + 1;
startn = p;
}
}
return 0;
}
#endif