Last change
on this file since 39a696b was 6262b5c, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Added include files for global functions and variables.
|
-
Property mode
set to
100644
|
File size:
649 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 |
|
---|
[6262b5c] | 8 | #include "all.h"
|
---|
[f40a309] | 9 |
|
---|
[7258c6a] | 10 | int16_t memcmpu(void *vp1, void *vp2, int16_t n)
|
---|
[f40a309] | 11 | {
|
---|
[7258c6a] | 12 | int8_t *cp1 = vp1;
|
---|
| 13 | int8_t *cp2 = vp2;
|
---|
| 14 | register int8_t c1, c2;
|
---|
[f40a309] | 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 | }
|
---|
[6262b5c] | 38 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.