xref: /original-bsd/games/monop/strcmp.c (revision 5848352c)
1 # include	<stdio.h>
2 # include	<ctype.h>
3 
4 # define	reg	register
5 
6 # define	makelower(c)	(isupper(c) ? tolower(c) : c)
7 
8 /*
9  * Compare strings:  s1>s2: >0  s1==s2: 0  s1<s2: <0
10  */
11 
12 strcmp(s1, s2)
13 reg char	*s1, *s2; {
14 
15 	while (makelower(*s1) == makelower(*s2)) {
16 		if (*s1 == '\0')
17 			return 0;
18 		s1++, s2++;
19 	}
20 	return *s1 - *s2;
21 }
22