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.
13 # define strcasecmp wcscasecmp
14 # define strcasecmp_l wcscasecmp_l
15 # ifdef __UCLIBC_DO_XLOCALE
16 libc_hidden_proto(towlower_l)
17 # define TOLOWER(C) towlower_l((C), locale_arg)
19 libc_hidden_proto(towlower)
20 # define TOLOWER(C) towlower((C))
23 # ifdef __UCLIBC_DO_XLOCALE
24 libc_hidden_proto(tolower_l)
25 # define TOLOWER(C) tolower_l((C), locale_arg)
27 libc_hidden_proto(tolower)
28 # define TOLOWER(C) tolower((C))
32 #if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE)
34 libc_hidden_proto(strcasecmp_l)
36 libc_hidden_proto(strcasecmp)
37 int strcasecmp(register const Wchar *s1, register const Wchar *s2)
39 return strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE);
41 libc_hidden_def(strcasecmp)
43 #else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
45 libc_hidden_proto(__XL_NPP(strcasecmp))
46 int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2
50 while ((*s1 == *s2) || (TOLOWER(*s1) == TOLOWER(*s2))) {
57 return (((Wuchar)TOLOWER(*s1)) < ((Wuchar)TOLOWER(*s2))) ? -1 : 1;
58 /* TODO -- should wide cmp funcs do wchar or Wuchar compares? */
62 while ( ((s1 == s2) ||
63 !(r = ((int)( TOLOWER(*((Wuchar *)s1))))
64 - TOLOWER(*((Wuchar *)s2))))
70 libc_hidden_def(__XL_NPP(strcasecmp))
72 #endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */