[BACK]Return to test-getsubopt.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

File: [cvsweb.bsd.lv] / mandoc / test-getsubopt.c (download)

Revision 1.2, Sat Jan 4 01:11:00 2014 UTC (7 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1, VERSION_1_12_4, VERSION_1_12
Changes since 1.1: +10 -3 lines

Clean up feature tests:
* Split the configure steering script out of the Makefile.
* Let the configure step depend on the test sources.
* Clean up the test programs such that they can be run.

#if defined(__linux__) || defined(__MINT__)
# define _GNU_SOURCE /* getsubopt() */
#endif

#include <stdlib.h>

extern char *suboptarg;

int
main(void)
{
	char buf[] = "k=v";
	char *options = buf;
	char token0[] = "k";
	char *const tokens[] = { token0, NULL };
	char *value = NULL;
	return( ! (0 == getsubopt(&options, tokens, &value)
	    && suboptarg == buf && value == buf+2 && options == buf+3));
}