cistrcmp.c (323B)
1 #include <u.h> 2 #include <libc.h> 3 4 int 5 cistrcmp(char *s1, char *s2) 6 { 7 int c1, c2; 8 9 while(*s1){ 10 c1 = *(uchar*)s1++; 11 c2 = *(uchar*)s2++; 12 13 if(c1 == c2) 14 continue; 15 16 if(c1 >= 'A' && c1 <= 'Z') 17 c1 -= 'A' - 'a'; 18 19 if(c2 >= 'A' && c2 <= 'Z') 20 c2 -= 'A' - 'a'; 21 22 if(c1 != c2) 23 return c1 - c2; 24 } 25 return -*s2; 26 }