00001
00002
00003
00004
00009 #include <ctype.h>
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012
00013 #include <yaz/ccl.h>
00014
00015 static int ccli_toupper (int c)
00016 {
00017 return toupper (c);
00018 }
00019
00020 int (*ccl_toupper)(int c) = NULL;
00021
00022 int ccl_stricmp (const char *s1, const char *s2)
00023 {
00024 if (!ccl_toupper)
00025 ccl_toupper = ccli_toupper;
00026 while (*s1 && *s2)
00027 {
00028 int c1, c2;
00029 c1 = (*ccl_toupper)(*s1);
00030 c2 = (*ccl_toupper)(*s2);
00031 if (c1 != c2)
00032 return c1 - c2;
00033 s1++;
00034 s2++;
00035 }
00036 return (*ccl_toupper)(*s1) - (*ccl_toupper)(*s2);
00037 }
00038
00039 int ccl_memicmp (const char *s1, const char *s2, size_t n)
00040 {
00041 if (!ccl_toupper)
00042 ccl_toupper = ccli_toupper;
00043 while (1)
00044 {
00045 int c1, c2;
00046
00047 c1 = (*ccl_toupper)(*s1);
00048 c2 = (*ccl_toupper)(*s2);
00049 if (n <= 1 || c1 != c2)
00050 return c1 - c2;
00051 s1++;
00052 s2++;
00053 --n;
00054 }
00055 }
00056
00057
00058
00059
00060
00061
00062
00063
00064