00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020
00021 #ifndef HAVE_STRNCASECMP
00022
00023 #include <string.h>
00024 #include <ctype.h>
00025
00026 int strncasecmp(const char *s1, const char *s2, unsigned int n)
00027 {
00028 if (n == 0)
00029 return 0;
00030
00031 while ((n-- != 0)
00032 && (tolower(*(unsigned char *) s1) ==
00033 tolower(*(unsigned char *) s2))) {
00034 if (n == 0 || *s1 == '\0' || *s2 == '\0')
00035 return 0;
00036 s1++;
00037 s2++;
00038 }
00039
00040 return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
00041 }
00042
00043 #endif