Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | FUNCTION |
---|
3 | <<wcsncasecmp_l>>---case-insensitive wide character string compare |
---|
4 | |
---|
5 | INDEX |
---|
6 | wcsncasecmp_l |
---|
7 | |
---|
8 | SYNOPSIS |
---|
9 | #include <wchar.h> |
---|
10 | int wcsncasecmp_l(const wchar_t *<[a]>, const wchar_t * <[b]>, |
---|
11 | size_t <[length]>, locale_t <[locale]>); |
---|
12 | |
---|
13 | DESCRIPTION |
---|
14 | <<wcsncasecmp_l>> compares up to <[length]> wide characters |
---|
15 | from the string at <[a]> to the string at <[b]> in a |
---|
16 | case-insensitive manner. |
---|
17 | |
---|
18 | if <[locale]> is LC_GLOBAL_LOCALE or not a valid locale object, the |
---|
19 | behaviour is undefined. |
---|
20 | |
---|
21 | RETURNS |
---|
22 | |
---|
23 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after |
---|
24 | both are converted to uppercase), <<wcsncasecmp_l>> returns a |
---|
25 | number greater than zero. If the two strings are equivalent, |
---|
26 | <<wcsncasecmp_l>> returns zero. If <<*<[a]>>> sorts |
---|
27 | lexicographically before <<*<[b]>>>, <<wcsncasecmp_l>> returns a |
---|
28 | number less than zero. |
---|
29 | |
---|
30 | PORTABILITY |
---|
31 | POSIX-1.2008 |
---|
32 | |
---|
33 | <<wcsncasecmp_l>> requires no supporting OS subroutines. It uses |
---|
34 | tolower() from elsewhere in this library. |
---|
35 | |
---|
36 | QUICKREF |
---|
37 | wcsncasecmp_l |
---|
38 | */ |
---|
39 | |
---|
40 | #include <wchar.h> |
---|
41 | #include <wctype.h> |
---|
42 | |
---|
43 | int |
---|
44 | wcsncasecmp_l (const wchar_t *s1, const wchar_t *s2, size_t n, |
---|
45 | struct __locale_t *locale) |
---|
46 | { |
---|
47 | int d = 0; |
---|
48 | for ( ; n != 0; n--) |
---|
49 | { |
---|
50 | const int c1 = towlower_l (*s1++, locale); |
---|
51 | const int c2 = towlower_l (*s2++, locale); |
---|
52 | if (((d = c1 - c2) != 0) || (c2 == '\0')) |
---|
53 | break; |
---|
54 | } |
---|
55 | return d; |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.