3 #include <gammu-unicode.h>
7 #ifndef HAVE_STRCASESTR
9 * Find the first occurrence of find in s, ignore case.
10 * Copyright (c) 1990, 1993 The Regents of the University of California.
12 char *strcasestr(const char *s
, const char *find
)
17 if ((c
= *find
++) != 0) {
18 c
= tolower((unsigned char)c
);
24 } while ((char)tolower((unsigned char)sc
) != c
);
25 } while (strncasecmp(s
, find
, len
) != 0);
32 #ifndef HAVE_STRCHRNUL
33 char *strchrnul(char *s
, int find
)
36 ret
= strchr(s
, find
);
37 if (ret
== NULL
) return s
+ strlen(s
);
43 #ifdef INTERNAL_STRNCASECMP
44 #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
46 * Case insensitive string comparator
47 * Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
49 int strncasecmp (const char *s1
, const char *s2
, size_t n
)
51 register const unsigned char *p1
= (const unsigned char *) s1
;
52 register const unsigned char *p2
= (const unsigned char *) s2
;
55 if (p1
== p2
|| n
== 0)
62 if (--n
== 0 || c1
== '\0')
69 return (c1
> c2
? 1 : c1
< c2
? -1 : 0);
74 #ifdef INTERNAL_STRCASECMP
75 #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
77 * Case insensitive string comparator
78 * Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
80 int strcasecmp (const char *s1
, const char *s2
)
82 register const unsigned char *p1
= (const unsigned char *) s1
;
83 register const unsigned char *p2
= (const unsigned char *) s2
;
100 return (c1
> c2
? 1 : c1
< c2
? -1 : 0);
105 #ifndef HAVE_TOWLOWER
106 /* FreeBSD boxes 4.7-STABLE does't have it, although it's ANSI standard */
107 wchar_t towlower(wchar_t c
)
109 unsigned char dest
[10];
111 DecodeWithUnicodeAlphabet(c
, dest
);
112 return tolower(dest
[0]);