00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "db_config.h"
00037
00038 #ifndef NO_SYSTEM_INCLUDES
00039 #include <string.h>
00040 #endif
00041
00042
00043
00044
00045
00046
00047 static const unsigned char charmap[] = {
00048 '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
00049 '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
00050 '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
00051 '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
00052 '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
00053 '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
00054 '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
00055 '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
00056 '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
00057 '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
00058 '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
00059 '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
00060 '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
00061 '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
00062 '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
00063 '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
00064 '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
00065 '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
00066 '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
00067 '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
00068 '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
00069 '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
00070 '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
00071 '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
00072 '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
00073 '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
00074 '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
00075 '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
00076 '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
00077 '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
00078 '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
00079 '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
00080 };
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 int
00091 strcasecmp(s1, s2)
00092 const char *s1, *s2;
00093 {
00094 register const unsigned char *cm = charmap,
00095 *us1 = (const unsigned char *)s1,
00096 *us2 = (const unsigned char *)s2;
00097
00098 while (cm[*us1] == cm[*us2++])
00099 if (*us1++ == '\0')
00100 return (0);
00101 return (cm[*us1] - cm[*--us2]);
00102 }
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 int
00113 strncasecmp(s1, s2, n)
00114 const char *s1, *s2;
00115 register size_t n;
00116 {
00117 if (n != 0) {
00118 register const unsigned char *cm = charmap,
00119 *us1 = (const unsigned char *)s1,
00120 *us2 = (const unsigned char *)s2;
00121
00122 do {
00123 if (cm[*us1] != cm[*us2++])
00124 return (cm[*us1] - cm[*--us2]);
00125 if (*us1++ == '\0')
00126 break;
00127 } while (--n != 0);
00128 }
00129 return (0);
00130 }