Mail Archives: djgpp/1996/09/25/05:52:37
On 24 Sep 1996, Alex Schroeder wrote:
> > DJGPP provides strncasecmp() also.
>
> So I can use either one or the other? How can I provide for compilers
> that provide only one of them, since I want my programm not only to
> compile under DJGPP but on other systems, too.
In general, this is the whole purpose of auto-configuration tools, such
as GNU Autoconf. However, I doubt that you could easily implement such a
beast on MSDOS, at least not as a general-purpose program. So, in this
case, I suggest something like that:
#ifndef HAVE_STRNCASECMP
#ifdef HAVE_STRICMP
#define strcasecmp(s,d) stricmp(s,d)
#else
/* Write your own case-insensitive comparison
function and put it here. Or put an #error directive
so that it won't compile. */
#endif
#endif
Then tell in the installation instruction to add an appropriate -D switch
to the definition of CFLAGS on the Makefile.
- Raw text -