Last change
on this file since 5c13d64 was 5c13d64, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Use void pointers for mem*() functions.
|
-
Property mode
set to
100644
|
File size:
636 bytes
|
Rev | Line | |
---|
[f40a309] | 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 |
|
---|
[5c13d64] | 10 | int memcmpu(void *vp1, void *vp2, int n)
|
---|
[f40a309] | 11 | {
|
---|
[5c13d64] | 12 | char *cp1 = vp1;
|
---|
| 13 | char *cp2 = vp2;
|
---|
[f40a309] | 14 | register char c1, c2;
|
---|
| 15 |
|
---|
| 16 | while (n) {
|
---|
| 17 |
|
---|
[5c13d64] | 18 | c1 = *cp1++;
|
---|
| 19 | c2 = *cp2++;
|
---|
[f40a309] | 20 |
|
---|
| 21 | if (isascii(c1) && islower(c1))
|
---|
| 22 | c1 = _toupper(c1);
|
---|
| 23 |
|
---|
| 24 | if (isascii(c2) && islower(c2))
|
---|
| 25 | c2 = _toupper(c2);
|
---|
| 26 |
|
---|
| 27 | if (c1 < c2)
|
---|
| 28 | return(-1);
|
---|
| 29 |
|
---|
| 30 | if (c1 > c2)
|
---|
| 31 | return(1);
|
---|
| 32 |
|
---|
| 33 | n--;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | return(0);
|
---|
| 37 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.