|
@@ -28,6 +28,7 @@
|
|
|
#include "rfc1459.h"
|
|
#include "rfc1459.h"
|
|
|
|
|
|
|
|
int (*rfc_casecmp) (const char *, const char *) = _rfc_casecmp;
|
|
int (*rfc_casecmp) (const char *, const char *) = _rfc_casecmp;
|
|
|
|
|
+int (*rfc_ncasecmp) (const char *, const char *, size_t) = _rfc_ncasecmp;
|
|
|
int (*rfc_toupper) (int) = _rfc_toupper;
|
|
int (*rfc_toupper) (int) = _rfc_toupper;
|
|
|
|
|
|
|
|
int
|
|
int
|
|
@@ -46,6 +47,26 @@ _rfc_casecmp(const char *s1, const char *s2)
|
|
|
return (res);
|
|
return (res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+int
|
|
|
|
|
+_rfc_ncasecmp(const char *s1, const char *s2, size_t n)
|
|
|
|
|
+{
|
|
|
|
|
+ register unsigned char *str1 = (unsigned char *) s1;
|
|
|
|
|
+ register unsigned char *str2 = (unsigned char *) s2;
|
|
|
|
|
+ register int res;
|
|
|
|
|
+
|
|
|
|
|
+ if (!n) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ while (--n && !(res = rfc_toupper(*str1) - rfc_toupper(*str2))) {
|
|
|
|
|
+ if (*str1 == '\0')
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ str1++;
|
|
|
|
|
+ str2++;
|
|
|
|
|
+ }
|
|
|
|
|
+ return (res);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
unsigned char rfc_touppertab[] = { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
|
|
unsigned char rfc_touppertab[] = { 0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa,
|
|
|
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
|
|
0xb, 0xc, 0xd, 0xe, 0xf, 0x10, 0x11, 0x12, 0x13, 0x14,
|
|
|
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
|
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|