libdl: first execute all destructors, then munmap library
[uclibc-ng.git] / libc / string / strcasestr.c
blob3334086bfd3db50d6807242f89e9831591a22477
1 /*
2 * Copyright (C) 2002 Manuel Novoa III
3 * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 */
8 #include "_string.h"
9 #include <ctype.h>
11 char *strcasestr(const char *s1, const char *s2)
13 register const char *s = s1;
14 register const char *p = s2;
16 #if 1
17 do {
18 if (!*p) {
19 return (char *) s1;;
21 if ((*p == *s)
22 || (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s)))
23 ) {
24 ++p;
25 ++s;
26 } else {
27 p = s2;
28 if (!*s) {
29 return NULL;
31 s = ++s1;
33 } while (1);
34 #else
35 while (*p && *s) {
36 if ((*p == *s)
37 || (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s)))
38 ) {
39 ++p;
40 ++s;
41 } else {
42 p = s2;
43 s = ++s1;
47 return (*p) ? NULL : (char *) s1;
48 #endif
50 libc_hidden_def(strcasestr)