Last change
on this file since 6dd74a9 was 0580615, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Point of no return.
|
-
Property mode
set to
100644
|
File size:
596 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 memcmpu(char *s1, char *s2, int n)
|
---|
11 | {
|
---|
12 | register char c1, c2;
|
---|
13 |
|
---|
14 | while (n) {
|
---|
15 |
|
---|
16 | c1 = *s1++;
|
---|
17 | c2 = *s2++;
|
---|
18 |
|
---|
19 | if (isascii(c1) && islower(c1))
|
---|
20 | c1 = _toupper(c1);
|
---|
21 |
|
---|
22 | if (isascii(c2) && islower(c2))
|
---|
23 | c2 = _toupper(c2);
|
---|
24 |
|
---|
25 | if (c1 < c2)
|
---|
26 | return(-1);
|
---|
27 |
|
---|
28 | if (c1 > c2)
|
---|
29 | return(1);
|
---|
30 |
|
---|
31 | n--;
|
---|
32 | }
|
---|
33 |
|
---|
34 | return(0);
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.