Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / string / wcscasecmp_l.c
blob3c58d8f50f5304eeaecf8295faca5b216d917957
1 /*
2 FUNCTION
3 <<wcscasecmp_l>>---case-insensitive wide character string compare
5 INDEX
6 wcscasecmp_l
8 SYNOPSIS
9 #include <wchar.h>
10 int wcscasecmp_l(const wchar_t *<[a]>, const wchar_t *<[b]>,
11 locale_t <[locale]>);
13 DESCRIPTION
14 <<wcscasecmp_l>> compares the wide character string at <[a]> to
15 the wide character string at <[b]> in a case-insensitive manner.
17 if <[locale]> is LC_GLOBAL_LOCALE or not a valid locale object,
18 the behaviour is undefined.
20 RETURNS
22 If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after
23 both are converted to uppercase), <<wcscasecmp_l>> returns a
24 number greater than zero. If the two strings match,
25 <<wcscasecmp_l>> returns zero. If <<*<[a]>>> sorts
26 lexicographically before <<*<[b]>>>, <<wcscasecmp_l>> returns a
27 number less than zero.
29 PORTABILITY
30 <<wcscasecmp_l>> is POSIX-1.2008
32 <<wcscasecmp_l>> requires no supporting OS subroutines. It uses
33 tolower() from elsewhere in this library.
35 QUICKREF
36 wcscasecmp_l
39 #include <wchar.h>
40 #include <wctype.h>
42 int
43 wcscasecmp_l (const wchar_t *s1, const wchar_t *s2, struct __locale_t *locale)
45 int d = 0;
46 for ( ; ; )
48 const int c1 = towlower_l (*s1++, locale);
49 const int c2 = towlower_l (*s2++, locale);
50 if (((d = c1 - c2) != 0) || (c2 == '\0'))
51 break;
53 return d;