httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/test testargs.c
Date Wed, 09 Aug 2000 14:55:45 GMT
wrowe       00/08/09 07:55:45

  Modified:    src/lib/apr/test testargs.c
  Log:
    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.
  
  Revision  Changes    Path
  1.15      +12 -5     apache-2.0/src/lib/apr/test/testargs.c
  
  Index: testargs.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testargs.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- testargs.c	2000/08/06 06:07:28	1.14
  +++ testargs.c	2000/08/09 14:55:44	1.15
  @@ -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");
  
  
  

Mime
View raw message