xref: /minix3/external/bsd/mdocml/dist/test-getsubopt.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
192395e9cSLionel Sambuc #if defined(__linux__) || defined(__MINT__)
292395e9cSLionel Sambuc # define _GNU_SOURCE /* getsubopt() */
392395e9cSLionel Sambuc #endif
492395e9cSLionel Sambuc 
592395e9cSLionel Sambuc #include <stdlib.h>
692395e9cSLionel Sambuc 
7*0a6a1f1dSLionel Sambuc extern char *suboptarg;
8*0a6a1f1dSLionel Sambuc 
992395e9cSLionel Sambuc int
main(void)10*0a6a1f1dSLionel Sambuc main(void)
1192395e9cSLionel Sambuc {
12*0a6a1f1dSLionel Sambuc 	char buf[] = "k=v";
13*0a6a1f1dSLionel Sambuc 	char *options = buf;
14*0a6a1f1dSLionel Sambuc 	char token0[] = "k";
15*0a6a1f1dSLionel Sambuc 	char *const tokens[] = { token0, NULL };
16*0a6a1f1dSLionel Sambuc 	char *value = NULL;
17*0a6a1f1dSLionel Sambuc 	return( ! (0 == getsubopt(&options, tokens, &value)
18*0a6a1f1dSLionel Sambuc 	    && suboptarg == buf && value == buf+2 && options == buf+3));
1992395e9cSLionel Sambuc }
20