Last change
on this file since 5f714c9 was f40a309, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Unix line breaks.
|
-
Property mode
set to
100644
|
File size:
611 bytes
|
Line | |
---|
1 | /*
|
---|
2 | ============================================================================
|
---|
3 | memcmpu -- compare two memory areas while ignoring case
|
---|
4 | Version 4 -- 1987-06-15 -- D.N. Lynx Crowe
|
---|
5 | ============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "ctype.h"
|
---|
9 |
|
---|
10 | int
|
---|
11 | memcmpu(s1, s2, n)
|
---|
12 | register char *s1, *s2;
|
---|
13 | int n;
|
---|
14 | {
|
---|
15 | register char c1, c2;
|
---|
16 |
|
---|
17 | while (n) {
|
---|
18 |
|
---|
19 | c1 = *s1++;
|
---|
20 | c2 = *s2++;
|
---|
21 |
|
---|
22 | if (isascii(c1) && islower(c1))
|
---|
23 | c1 = _toupper(c1);
|
---|
24 |
|
---|
25 | if (isascii(c2) && islower(c2))
|
---|
26 | c2 = _toupper(c2);
|
---|
27 |
|
---|
28 | if (c1 < c2)
|
---|
29 | return(-1);
|
---|
30 |
|
---|
31 | if (c1 > c2)
|
---|
32 | return(1);
|
---|
33 |
|
---|
34 | n--;
|
---|
35 | }
|
---|
36 |
|
---|
37 | return(0);
|
---|
38 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.