From 249866e3d1e11dc72eaa1305f4bb479ded92ef38 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 13:58:20 +0200 Subject: reorganized file structure Moved c files into src/. Corrected VERSION file. Removed BUILD and FILES. --- case.c | 134 ----------------------------------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 case.c (limited to 'case.c') diff --git a/case.c b/case.c deleted file mode 100644 index 47eb8ed..0000000 --- a/case.c +++ /dev/null @@ -1,134 +0,0 @@ -#include "case.h" -#include "str.h" - -/** - @file case.c - @author djb - @brief string comparison and helper functions; case insensitive -*/ - -int case_diffb(register char *s,unsigned int len,register char *t) -{ - register unsigned char x; - register unsigned char y; - - while (len > 0) { - --len; - x = *s++ - 'A'; - if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; - y = *t++ - 'A'; - if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; - if (x != y) - return ((int)(unsigned int) x) - ((int)(unsigned int) y); - } - return 0; -} - -int case_diffs(register char *s,register char *t) -{ - register unsigned char x; - register unsigned char y; - - for (;;) { - x = *s++ - 'A'; - if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; - y = *t++ - 'A'; - if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; - if (x != y) break; - if (!x) break; - } - return ((int)(unsigned int) x) - ((int)(unsigned int) y); -} - -int case_diffrs(register char *s,register char *t) -{ - register unsigned char x = 0; - register unsigned char y = 0; - unsigned int lens = str_len(s); - unsigned int lent = str_len(t); - - while (lens > 0 && lent > 0) { - x = s[--lens] - 'A'; - if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; - y = t[--lent] - 'A'; - if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; - if (x != y) break; - if (!x) break; - if (!y) break; - } - return ((int)(unsigned int) x) - ((int)(unsigned int) y); -} - -void case_lowerb(char *s,unsigned int len) -{ - unsigned char x; - while (len > 0) { - --len; - x = *s - 'A'; - if (x <= 'Z' - 'A') *s = x + 'a'; - ++s; - } -} - -void case_lowers(char *s) -{ - unsigned char x; - while ((x = *s)) { - x -= 'A'; - if (x <= 'Z' - 'A') *s = x + 'a'; - ++s; - } -} - -void case_upperb(char *s,unsigned int len) -{ - unsigned char x; - while (len > 0) { - --len; - x = *s - 'a'; - if (x <= 'z' - 'a') *s = x + 'A'; - ++s; - } -} - -void case_uppers(char *s) -{ - unsigned char x; - while ((x = *s)) { - x -= 'a'; - if (x <= 'z' - 'a') *s = x + 'A'; - ++s; - } -} - -int case_startb(register char *s,unsigned int len,register char *t) -{ - register unsigned char x; - register unsigned char y; - - for (;;) { - y = *t++ - 'A'; - if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; - if (!y) return 1; - if (!len) return 0; - --len; - x = *s++ - 'A'; - if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; - if (x != y) return 0; - } -} - -int case_starts(register char *s,register char *t) -{ - register unsigned char x; - register unsigned char y; - - for (;;) { - x = *s++ - 'A'; - if (x <= 'Z' - 'A') x += 'a'; else x += 'A'; - y = *t++ - 'A'; - if (y <= 'Z' - 'A') y += 'a'; else y += 'A'; - if (!y) return 1; - if (x != y) return 0; - } -} -- cgit v1.2.3