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