diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-09 14:55:44 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-09 14:55:44 +0000 |
commit | 87f43184109ebcdfb9148794dd529469fbe52f7a (patch) | |
tree | c4abb52f055215af384ccd789f38392f069796d9 | |
parent | 6d025711a3d21c34231c94a0cee5f07a1c54e8ed (diff) | |
download | libapr-87f43184109ebcdfb9148794dd529469fbe52f7a.tar.gz |
Fix the Win32 linker .def for APR (for my last several commits), and
provide the first real 'test' of the new apr_initopt/apr_getopt.
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60492 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | test/testargs.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/test/testargs.c b/test/testargs.c index 9ab990679..0596131c4 100644 --- a/test/testargs.c +++ b/test/testargs.c @@ -66,25 +66,32 @@ int main(int argc, char * const argv[]) { apr_pool_t *context; - apr_int32_t data; + apr_getopt_t *opt; + char data; + const char *optarg; apr_initialize(); atexit(apr_terminate); apr_create_pool(&context, NULL); - while (apr_getopt(argc, argv, "abc:d::", &data, context) == APR_SUCCESS) { + if (apr_initopt(&opt, context, argc, argv)) + { + printf("failed to initialize opts"); + exit(1); + } + while (apr_getopt(opt, "abc:d::", &data, &optarg) == APR_SUCCESS) { switch(data) { case 'a': case 'b': printf("option %c\n", data); break; case 'c': - printf("option %c with %s\n", data, apr_optarg); + printf("option %c with %s\n", data, optarg); break; case 'd': printf("option %c", data); - if (apr_optarg) { - printf(" with %s\n", apr_optarg); + if (optarg) { + printf(" with %s\n", optarg); } else { printf("\n"); |