From 6d55934c65607a0db77403b6b364af25e7ae1a70 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sat, 4 Jan 2014 01:11:00 +0000 Subject: 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. --- test-getsubopt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'test-getsubopt.c') diff --git a/test-getsubopt.c b/test-getsubopt.c index 25e11246..2da98238 100644 --- a/test-getsubopt.c +++ b/test-getsubopt.c @@ -4,9 +4,16 @@ #include +extern char *suboptarg; + int -main(int argc, char **argv) +main(void) { - getsubopt(argv, argv, argv); - return 0; + 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)); } -- cgit v1.2.3-56-ge451