diff options
Diffstat (limited to 'case_diffs.c')
| -rw-r--r-- | case_diffs.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/case_diffs.c b/case_diffs.c new file mode 100644 index 0000000..212c645 --- /dev/null +++ b/case_diffs.c | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #include "case.h" | ||
| 2 | |||
| 3 | int case_diffs(s,t) | ||
| 4 | register char *s; | ||
| 5 | register char *t; | ||
| 6 | { | ||
| 7 | register unsigned char x; | ||
| 8 | register unsigned char y; | ||
| 9 | |||
| 10 | for (;;) { | ||
| 11 | x = *s++ - 'A'; | ||
| 12 | if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; | ||
| 13 | y = *t++ - 'A'; | ||
| 14 | if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; | ||
| 15 | if (x != y) break; | ||
| 16 | if (!x) break; | ||
| 17 | } | ||
| 18 | return ((int)(unsigned int) x) - ((int)(unsigned int) y); | ||
| 19 | } | ||
