about summary refs log tree commit diff
path: root/lib/util
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-04-25 23:42:36 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-04-25 23:42:36 +0000
commitbb9e9503f46ac7c10de38c8cb5201fd253108f00 (patch)
tree8c430832f0cdc495221b6a19ee20632732fae7f3 /lib/util
parentcc9843c2af5cc59ca1478f73eb4be24cbbf793a0 (diff)
downloadnetpbm-mirror-bb9e9503f46ac7c10de38c8cb5201fd253108f00.tar.gz
netpbm-mirror-bb9e9503f46ac7c10de38c8cb5201fd253108f00.tar.xz
netpbm-mirror-bb9e9503f46ac7c10de38c8cb5201fd253108f00.zip
Recognize _XOPEN_SOURCE 500 as another way of requesting strcasecmp
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3207 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/nstring.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/util/nstring.h b/lib/util/nstring.h
index bded8417..9801ca17 100644
--- a/lib/util/nstring.h
+++ b/lib/util/nstring.h
@@ -64,11 +64,17 @@ memeq(const void * const comparand,
     return memcmp(comparand, comparator, size) == 0;
 }
 
-/* The Standard C Library may not declare strcasecmp() if the including
-   source file doesn't request BSD functions, with _BSD_SOURCE.  So
-   we don't define functions that use strcasecmp() in that case.
+/* The Standard C Library may not declare strcasecmp() if the including source
+   file doesn't request BSD functions, with _BSD_SOURCE or SUSv2 function,
+   with _XOPEN_SOURCE >= 500.  So we don't define functions that use
+   strcasecmp() in that case.
+
+   (Actually, _XOPEN_SOURCE 500 is stronger than you need for strcasecmp -
+   _XOPEN_SOURCE_EXTENDED, which asks for XPG 4 would do, whereas
+   _XOPEN_SOURCE 500 asks for XPG 5, but for simplicity, we don't use
+   _XOPEN_SOURCE_EXTENDED in Netpbm.
 */
-#ifdef _BSD_SOURCE
+#if defined(_BSD_SOURCE) || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0) >= 500)
 static __inline__ int
 strcaseeq(const char * const comparand,
           const char * const comparator) {