=================================================================== RCS file: /cvs/mandoc/test-getsubopt.c,v retrieving revision 1.3 retrieving revision 1.6 diff -u -p -r1.3 -r1.6 --- mandoc/test-getsubopt.c 2014/08/17 20:53:50 1.3 +++ mandoc/test-getsubopt.c 2018/08/15 14:37:41 1.6 @@ -1,4 +1,4 @@ -/* $Id: test-getsubopt.c,v 1.3 2014/08/17 20:53:50 schwarze Exp $ */ +/* $Id: test-getsubopt.c,v 1.6 2018/08/15 14:37:41 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * @@ -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 +/* + * NetBSD declared this function in the wrong header before August 2018. + * No harm is done by allowing that, too: + * The only file using it, main.c, also includes unistd.h, anyway. + */ +#include + int main(void) { @@ -29,6 +32,6 @@ main(void) char token0[] = "k"; char *const tokens[] = { token0, NULL }; char *value = NULL; - return( ! (0 == getsubopt(&options, tokens, &value) - && value == buf+2 && options == buf+3)); + return ! (getsubopt(&options, tokens, &value) == 0 + && value == buf+2 && options == buf+3); }