mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-16 01:40:52 +08:00
26 lines
430 B
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
|