home *** CD-ROM | disk | FTP | other *** search
- #include <ctype.h>
- #include <string.h>
- #include <stdio.h>
-
- #include "config.h"
-
- Prototype char *stristr (const char *, const char *);
-
- /*
- ** stristr
- **
- ** Just like strstr() except case insensitive
- */
-
- char *
- stristr (const char *s1, const char *s2)
- {
- int
- c = tolower (*s2),
- l2 = strlen (s2);
-
- if (l2 == 0)
- return s1;
-
- while (*s1) {
- if (tolower (*s1) == c && strnicmp (s1, s2, l2) == 0)
- return s1;
- s1++;
- }
-
- return NULL;
- }
-