aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test-getsubopt.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-01-04 01:11:00 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-01-04 01:11:00 +0000
commit6d55934c65607a0db77403b6b364af25e7ae1a70 (patch)
treee8de91439269693965fab1cfabe18975512e7763 /test-getsubopt.c
parent25d3bfdfd1b1a2da2d820f6bbb0406ef7dd2466c (diff)
downloadmandoc-6d55934c65607a0db77403b6b364af25e7ae1a70.tar.gz
mandoc-6d55934c65607a0db77403b6b364af25e7ae1a70.tar.zst
mandoc-6d55934c65607a0db77403b6b364af25e7ae1a70.zip
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.
Diffstat (limited to 'test-getsubopt.c')
-rw-r--r--test-getsubopt.c13
1 files changed, 10 insertions, 3 deletions
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 <stdlib.h>
+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));
}