xref: /inferno-os/libkern/strcmp.c (revision 7ef44d652ae9e5e1f5b3465d73684e4a54de73c0)
1 #include <lib9.h>
2 
3 int
4 strcmp(char *s1, char *s2)
5 {
6 	unsigned c1, c2;
7 
8 	for(;;) {
9 		c1 = *s1++;
10 		c2 = *s2++;
11 		if(c1 != c2) {
12 			if(c1 > c2)
13 				return 1;
14 			return -1;
15 		}
16 		if(c1 == 0)
17 			return 0;
18 	}
19 }
20