summaryrefslogtreecommitdiff
path: root/dviware/beebe/src/strcm2.h
blob: 38c2fb65a610c0f648aa6feb50f9718bfb954461 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* -*-C-*- strcm2.h */
/*-->strcm2*/
/**********************************************************************/
/******************************* strcm2 *******************************/
/**********************************************************************/


/***********************************************************************
 Compare strings (ignoring case), and return:
	s1>s2:	>0
	s1==s2:  0
	s1<s2:	<0
***********************************************************************/

/* toupper() is supposed to work for all letters, but PCC-20 does it
incorrectly if the argument is not already lowercase; this definition
fixes that. */

#define UC(c) (islower(c) ? toupper(c) : c)

int
strcm2(s1, s2)
register char *s1, *s2;

{
    while ((*s1) && (UC(*s1) == UC(*s2)))
    {
	s1++;
	s2++;
    }
    return((int)(UC(*s1) - UC(*s2)));
}
#undef UC