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