source:
buchla-68k/libsm/memcmpu.c@
0acb7d0
Last change on this file since 0acb7d0 was dade7a0, checked in by , 7 years ago | |
---|---|
|
|
File size: 665 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 | ||
[b28a12e] | 8 | #include "ram.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)) | |
[dade7a0] | 22 | c1 = (int8_t)_toupper(c1); |
[f40a309] | 23 | |
24 | if (isascii(c2) && islower(c2)) | |
[dade7a0] | 25 | c2 = (int8_t)_toupper(c2); |
[f40a309] | 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.