summaryrefslogtreecommitdiff
path: root/test/testargs.c
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2000-08-09 14:55:44 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2000-08-09 14:55:44 +0000
commitc914e5123ffba65fb82881da76de89520776785e (patch)
treec4abb52f055215af384ccd789f38392f069796d9 /test/testargs.c
parentba87afb2b33e8c04eaccd5aba8e51772c07ffb76 (diff)
downloadapr-c914e5123ffba65fb82881da76de89520776785e.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: https://svn.apache.org/repos/asf/apr/apr/trunk@60492 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testargs.c')
-rw-r--r--test/testargs.c17
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");