tstrcasestr.c - iomenu - interactive terminal-based selection menu
(HTM) git clone git://bitreich.org/iomenu git://hg6vgqziawt5s4dj.onion/iomenu
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
tstrcasestr.c (368B)
---
1 #include <ctype.h>
2 #include <stddef.h>
3
4 #include "compat.h"
5
6 char *
7 strcasestr(const char *str1, const char *str2)
8 {
9 const char *s1;
10 const char *s2;
11
12 for (;;) {
13 s1 = str1;
14 s2 = str2;
15 while (*s1 != '\0' && tolower(*s1) == tolower(*s2))
16 s1++, s2++;
17 if (*s2 == '\0')
18 return (char *) str1;
19 if (*s1 == '\0')
20 return NULL;
21 str1++;
22 }
23
24 return NULL;
25 }