aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test-getsubopt.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-08-15 02:15:52 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-08-15 02:15:52 +0000
commit72b08051834f48e51407e7cebe8719cc5b6555a3 (patch)
treee68b559eae1648423af5c990f0c5ed0467ac2880 /test-getsubopt.c
parent239614951577ba74078ca14afdba3508fb622fcb (diff)
downloadmandoc-72b08051834f48e51407e7cebe8719cc5b6555a3.tar.gz
mandoc-72b08051834f48e51407e7cebe8719cc5b6555a3.tar.zst
mandoc-72b08051834f48e51407e7cebe8719cc5b6555a3.zip
Autodetect whether _GNU_SOURCE or _OPENBSD_SOURCE are needed; the
latter is a NetBSD idiosyncrasy reported by wiz@. Also take into account that NetBSD declares getsubopt(3) in the wrong header.
Diffstat (limited to 'test-getsubopt.c')
-rw-r--r--test-getsubopt.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/test-getsubopt.c b/test-getsubopt.c
index afcc5599..752c1cde 100644
--- a/test-getsubopt.c
+++ b/test-getsubopt.c
@@ -1,4 +1,4 @@
-/* $Id: test-getsubopt.c,v 1.4 2015/10/06 18:32:20 schwarze Exp $ */
+/* $Id: test-getsubopt.c,v 1.5 2018/08/15 02:15:52 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -15,12 +15,15 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(__linux__) || defined(__MINT__)
-#define _GNU_SOURCE /* getsubopt() */
-#endif
-
#include <stdlib.h>
+/*
+ * NetBSD declares this function in the wrong header.
+ * No harm is done by allowing that, too:
+ * The only file using it, main.c, also includes unistd.h, anyway.
+ */
+#include <unistd.h>
+
int
main(void)
{