acl/app/jaws/global/string.c

26 lines
430 B
C
Raw Normal View History

#include <ctype.h>
2014-11-19 00:25:21 +08:00
#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