www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/25/05:52:37

Date: Wed, 25 Sep 1996 11:31:22 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Alex Schroeder <alex AT zool DOT unizh DOT ch>
Cc: djgpp AT delorie DOT com
Subject: Re: strncasecmp!?
In-Reply-To: <528m2q$eiq@rzunews.unizh.ch>
Message-Id: <Pine.SUN.3.91.960925112624.13932E-100000@is>
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019