Last change
on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
649 bytes
|
Rev | Line | |
---|
[3ae31e9] | 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.