On Tue, 2 Jan 2001, Rev. Bob 'Bob' Crispen wrote:
> Actually, I did it a quick and dirty way (ignoring the possibility that
> both strcasecmp and stricmp were missing):
>
> #ifndef HAVE_STRCASECMP
> #define strcasecmp stricmp
> #endif
What about this then:
#ifndef HAVE_STRCASECMP # ifdef HAVE_STRICMP # define strcasecmp(x,y) stricmp(x,y) # else # ifdef HAVE_STRCMPI # define strcasecmp(x,y) strcmpi(x,y) # else # /* no case insensitive function available */ # define USE_OUR_OWN_STRCASECMP # endif # endif
# ifdef USE_OUR_OWN_STRCASECMP
int strcasecmp(const char *first, const char *second)
{
while (*first && *second) {
if (toupper((int)*first) != toupper((int)*second))
break;
first++;
second++;
}
return toupper((int)*first) - toupper((int)*second);
}
# endif
#endif /* HAVE_STRCASECMP */
> And just to add to the amusement, I've seen the function called strcmpi()
> somewhere.
Yes. Well, if you stick the above stuff in a header file somewhere. I'll add the checks for stricmp() and strcmpi() to the configure script.
-- Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77 ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`olReceived on Wed 03 Jan 2001 02:50:15 PM GMT
This archive was generated by hypermail 2.2.0 : Thu 22 Feb 2007 07:33:52 PM GMT GMT