1 /* 2 * strcasecmp.c -- provides strcasecmp() and strncasecmp if necessary. 3 * 4 * $Id: strcasecmp.c,v 1.4 2003/11/28 20:11:06 [Xp-AvR] Exp $ 5 */ 6 7 #include "main.h" 8 #include "memcpy.h" 9 10 #ifndef HAVE_STRCASECMP EvangelineStrcasecmp(const char * s1,const char * s2)11int EvangelineStrcasecmp(const char *s1, const char *s2) 12 { 13 while ((*s1) && (*s2) && (toupper(*s1) == toupper(*s2))) { 14 s1++; 15 s2++; 16 } 17 return toupper(*s1) - toupper(*s2); 18 } 19 #endif /* !HAVE_STRCASECMP */ 20 21 #ifndef HAVE_STRNCASECMP EvangelineStrncasecmp(const char * s1,const char * s2,size_t n)22int EvangelineStrncasecmp(const char *s1, const char *s2, size_t n) 23 { 24 if (!n) 25 return 0; 26 while (--n && (*s1) && (*s2) && (toupper(*s1) == toupper(*s2))) { 27 s1++; 28 s2++; 29 } 30 return toupper(*s1) - toupper(*s2); 31 } 32 #endif /* !HAVE_STRNCASECMP */ 33