Subject: bug#18366: 24.3.93; Definition of strnicmp needed for Cygwin-w32 build

From: Eli Zaretskii <[email-masked]>
Date: Sat, 30 Aug 2014 22:15:38 +0300

> Date: Sat, 30 Aug 2014 14:16:03 -0400
> From: Ken Brown <[email-masked]>
> 
> Cygwin's /usr/include/string.h, which comes from newlib, contains a 
> definition of strnicmp; this is needed for the Cygwin-w32 build.  That 
> definition has recently been dropped from newlib

Why did they do such a thing?

> --- src/cygw32.h        2014-01-01 07:43:34 +0000
> +++ src/cygw32.h        2014-08-30 17:51:36 +0000
> @@ -33,6 +33,11 @@
>   #include "lisp.h"
>   #include "coding.h"
> 
> +/* The following was in /usr/include/string.h prior to Cygwin 1.7.33.  */
> +#ifndef strnicmp
> +#define strnicmp strncasecmp
> +#endif

The proper place for this kind of thing is src/conf_post.h, which will
also make sure you won't need to include cygw32.h in every file that
uses that function.  (You'd probably need to condition this on
HAVE_NTGUI in addition to __CYGWIN__.)

I'd also suggest to consider whether to make this a macro or an inline
function, and perhaps also condition that on the Cygwin or newlib's
version rather than on #ifndef (what if newlib will add a function by
that name?).  But this is up to you.

> Is it OK for the release branch?

Yes, with the above taken care of.

Thanks.