Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6557 | serge | 1 | /* |
2 | FUNCTION |
||
3 | < |
||
4 | |||
5 | INDEX |
||
6 | wcsncasecmp |
||
7 | |||
8 | ANSI_SYNOPSIS |
||
9 | #include |
||
10 | int wcsncasecmp(const wchar_t *<[a]>, const wchar_t * <[b]>, size_t <[length]>); |
||
11 | |||
12 | TRAD_SYNOPSIS |
||
13 | #include |
||
14 | int wcsncasecmp(<[a]>, <[b]>, <[length]>) |
||
15 | wchar_t *<[a]>; |
||
16 | wchar_t *<[b]>; |
||
17 | size_t <[length]> |
||
18 | |||
19 | DESCRIPTION |
||
20 | < |
||
21 | from the string at <[a]> to the string at <[b]> in a |
||
22 | case-insensitive manner. |
||
23 | |||
24 | RETURNS |
||
25 | |||
26 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after |
||
27 | both are converted to uppercase), < |
||
28 | number greater than zero. If the two strings are equivalent, |
||
29 | < |
||
30 | lexicographically before <<*<[b]>>>, < |
||
31 | number less than zero. |
||
32 | |||
33 | PORTABILITY |
||
34 | POSIX-1.2008 |
||
35 | |||
36 | < |
||
37 | tolower() from elsewhere in this library. |
||
38 | |||
39 | QUICKREF |
||
40 | wcsncasecmp |
||
41 | */ |
||
42 | |||
43 | #include |
||
44 | #include |
||
45 | |||
46 | int |
||
47 | _DEFUN (wcsncasecmp, (s1, s2, n), |
||
48 | _CONST wchar_t *s1 _AND |
||
49 | _CONST wchar_t *s2 _AND |
||
50 | size_t n) |
||
51 | { |
||
52 | if (n == 0) |
||
53 | return 0; |
||
54 | |||
55 | while (n-- != 0 && towlower(*s1) == towlower(*s2)) |
||
56 | { |
||
57 | if (n == 0 || *s1 == '\0' || *s2 == '\0') |
||
58 | break; |
||
59 | s1++; |
||
60 | s2++; |
||
61 | } |
||
62 | |||
63 | return towlower(*s1) - towlower(*s2); |
||
64 | } |