xref: /netbsd-src/external/bsd/mdocml/dist/test-getsubopt.c (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 #if defined(__linux__) || defined(__MINT__)
2 # define _GNU_SOURCE /* getsubopt() */
3 #endif
4 
5 #include <stdlib.h>
6 
7 extern char *suboptarg;
8 
9 int
10 main(void)
11 {
12 	char buf[] = "k=v";
13 	char *options = buf;
14 	char token0[] = "k";
15 	char *const tokens[] = { token0, NULL };
16 	char *value = NULL;
17 	return( ! (0 == getsubopt(&options, tokens, &value)
18 	    && suboptarg == buf && value == buf+2 && options == buf+3));
19 }
20