Back to index

tetex-bin  3.0
strcasecmp.c
Go to the documentation of this file.
00001 #include "dialogconfig.h"
00002 
00003 /* GNU Library doesn't have toupper().  Until GNU gets this fixed, I will
00004    have to do it. */
00005 #ifndef toupper
00006 #define toupper(c) ((c) - 32)
00007 #endif
00008 
00009 #define coerce_to_upper(c) ((islower(c) ? toupper(c) : (c)))
00010 
00011 #if !defined (HAVE_STRCASECMP)
00012 int strcasecmp (char *string1, char * string2)
00013 {
00014   char ch1, ch2;
00015 
00016   for (;;)
00017     {
00018       ch1 = *string1++;
00019       ch2 = *string2++;
00020 
00021       if (!(ch1 | ch2))
00022         return (0);
00023 
00024       ch1 = coerce_to_upper (ch1);
00025       ch2 = coerce_to_upper (ch2);
00026 
00027       if (ch1 != ch2)
00028         return (ch1 - ch2);
00029     }
00030 }
00031 #endif /* !HAVE_STRCASECMP */