|
|
1.1 ! root 1: /* ! 2: * Case insensative string compare. ! 3: */ ! 4: strcmpl(s1, s2) ! 5: register unsigned char *s1, *s2; ! 6: { ! 7: register c, d; ! 8: ! 9: for (;;) { ! 10: switch(c = *s1++ - (d = *s2++)) { ! 11: case 0: ! 12: if(!d) ! 13: break; ! 14: continue; ! 15: case ('A' - 'a'): ! 16: if((d < 'a') || (d > 'z')) ! 17: break; ! 18: continue; ! 19: case ('a' - 'A'): ! 20: if((d < 'A') || (d > 'Z')) ! 21: break; ! 22: continue; ! 23: } ! 24: return(c); ! 25: } ! 26: } ! 27: ! 28: #ifdef TEST ! 29: #include "misc.h" ! 30: main() ! 31: { ! 32: char s1[40], s2[40]; ! 33: ! 34: for (;;) { ! 35: ask(s1, "string1"); ! 36: ask(s2, "string2"); ! 37: printf("strcmpl(%s, %s) == %d\n", s1, s2, strcmpl(s1, s2)); ! 38: } ! 39: } ! 40: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.