source: buchla-68k/libsm/memcmpu.c@ fe7b401

Last change on this file since fe7b401 was dade7a0, checked in by Thomas Lopatic <thomas@…>, 7 years ago

No more warnings in libsm.

  • Property mode set to 100644
File size: 665 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 "ram.h"
9
10int16_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 = (int8_t)_toupper(c1);
23
24 if (isascii(c2) && islower(c2))
25 c2 = (int8_t)_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.