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 #include "main.h"
00029
00030 int _rfc_casecmp(const char *s1, const char *s2)
00031 {
00032 register unsigned char *str1 = (unsigned char *) s1;
00033 register unsigned char *str2 = (unsigned char *) s2;
00034 register int res;
00035
00036 while (!(res = rfc_toupper(*str1) - rfc_toupper(*str2))) {
00037 if (*str1 == '\0')
00038 return 0;
00039 str1++;
00040 str2++;
00041 }
00042 return res;
00043 }
00044
00045 int _rfc_ncasecmp(const char *str1, const char *str2, int n)
00046 {
00047 register unsigned char *s1 = (unsigned char *) str1;
00048 register unsigned char *s2 = (unsigned char *) str2;
00049 register int res;
00050
00051 while (!(res = rfc_toupper(*s1) - rfc_toupper(*s2))) {
00052 s1++;
00053 s2++;
00054 n--;
00055 if (!n || (*s1 == '\0' && *s2 == '\0'))
00056 return 0;
00057 }
00058 return res;
00059 }
00060
00061 unsigned char rfc_tolowertab[];
00062 unsigned char rfc_touppertab[];
00063
00064 int _rfc_tolower(int c)
00065 {
00066 return rfc_tolowertab[(unsigned char) (c)];
00067 }
00068
00069 int _rfc_toupper(int c)
00070 {
00071 return rfc_touppertab[(unsigned char) (c)];
00072 }
00073
00074 unsigned char rfc_tolowertab[] =
00075 { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
00076 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
00077 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
00078 0x1e, 0x1f,
00079 ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
00080 '*', '+', ',', '-', '.', '/',
00081 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
00082 ':', ';', '<', '=', '>', '?',
00083 '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
00084 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
00085 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
00086 '_',
00087 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
00088 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
00089 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
00090 0x7f,
00091 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
00092 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
00093 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
00094 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
00095 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
00096 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
00097 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
00098 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
00099 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
00100 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
00101 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
00102 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
00103 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
00104 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
00105 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
00106 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
00107 };
00108
00109 unsigned char rfc_touppertab[] =
00110 { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
00111 0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
00112 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
00113 0x1e, 0x1f,
00114 ' ', '!', '"', '#', '$', '%', '&', 0x27, '(', ')',
00115 '*', '+', ',', '-', '.', '/',
00116 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
00117 ':', ';', '<', '=', '>', '?',
00118 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
00119 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
00120 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
00121 0x5f,
00122 '`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
00123 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
00124 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^',
00125 0x7f,
00126 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
00127 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
00128 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
00129 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
00130 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
00131 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
00132 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9,
00133 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
00134 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
00135 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
00136 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
00137 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
00138 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
00139 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
00140 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
00141 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
00142 };