Rev 1693 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1693 | serge | 1 | /* |
2 | FUNCTION |
||
3 | < |
||
4 | |||
5 | INDEX |
||
6 | strcasecmp |
||
7 | |||
8 | ANSI_SYNOPSIS |
||
3065 | serge | 9 | #include |
1693 | serge | 10 | int strcasecmp(const char *<[a]>, const char *<[b]>); |
11 | |||
12 | TRAD_SYNOPSIS |
||
3065 | serge | 13 | #include |
1693 | serge | 14 | int strcasecmp(<[a]>, <[b]>) |
15 | char *<[a]>; |
||
16 | char *<[b]>; |
||
17 | |||
18 | DESCRIPTION |
||
19 | < |
||
20 | the string at <[b]> in a case-insensitive manner. |
||
21 | |||
22 | RETURNS |
||
23 | |||
24 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>> (after |
||
25 | both are converted to lowercase), < |
||
26 | number greater than zero. If the two strings match, |
||
27 | < |
||
28 | lexicographically before <<*<[b]>>>, < |
||
29 | number less than zero. |
||
30 | |||
31 | PORTABILITY |
||
32 | < |
||
33 | |||
34 | < |
||
35 | tolower() from elsewhere in this library. |
||
36 | |||
37 | QUICKREF |
||
38 | strcasecmp |
||
39 | */ |
||
40 | |||
3065 | serge | 41 | #include |
1693 | serge | 42 | #include |
43 | |||
44 | int |
||
45 | _DEFUN (strcasecmp, (s1, s2), |
||
46 | _CONST char *s1 _AND |
||
47 | _CONST char *s2) |
||
48 | { |
||
49 | _CONST unsigned char *ucs1 = (_CONST unsigned char *) s1; |
||
50 | _CONST unsigned char *ucs2 = (_CONST unsigned char *) s2; |
||
51 | int d = 0; |
||
52 | for ( ; ; ) |
||
53 | { |
||
54 | _CONST int c1 = tolower(*ucs1++); |
||
55 | _CONST int c2 = tolower(*ucs2++); |
||
56 | if (((d = c1 - c2) != 0) || (c2 == '\0')) |
||
57 | break; |
||
58 | } |
||
59 | return d; |
||
60 | } |