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