xref: /minix3/external/bsd/mdocml/dist/test-getsubopt.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
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
main(void)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