Merge branch 's3_crypto' of github.com:hualongfeng/fio
[fio.git] / oslib / strcasestr.c
1 #ifndef CONFIG_STRCASESTR
2
3 #include <ctype.h>
4 #include <stddef.h>
5 #include "strcasestr.h"
6
7 char *strcasestr(const char *s1, const char *s2)
8 {
9         const char *s = s1;
10         const char *p = s2;
11
12         do {
13                 if (!*p)
14                         return (char *) s1;
15                 if ((*p == *s) ||
16                     (tolower(*p) == tolower(*s))) {
17                         ++p;
18                         ++s;
19                 } else {
20                         p = s2;
21                         if (!*s)
22                                 return NULL;
23                         s = ++s1;
24                 }
25         } while (1);
26
27         return *p ? NULL : (char *) s1;
28 }
29
30 #endif