~ubuntu-branches/ubuntu/hardy/gengetopt/hardy

« back to all changes in this revision

Viewing changes to tests/test_modes.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-01-29 14:55:40 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080129145540-bkah1bl330gpelmh
Tags: 2.22-1ubuntu1
* Merge with Debian; remaining changes:
  - Fix build failures with g++-4.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* test_modes.c test */
 
2
 
 
3
/* test all kinds of options */
 
4
 
 
5
#include <stdlib.h>
 
6
#include <stdio.h>
 
7
 
 
8
#include "test_modes_cmd.h"
 
9
 
 
10
static struct gengetopt_args_info args_info;
 
11
 
 
12
int
 
13
main (int argc, char **argv)
 
14
{  
 
15
  unsigned int i;
 
16
  if (test_modes_cmd_parser (argc, argv, &args_info) != 0)
 
17
    exit(1) ;
 
18
 
 
19
  if (args_info.optA_given)
 
20
    {
 
21
      printf("optA given\n");
 
22
      if (args_info.optA_arg)
 
23
        printf("optA arg: %s\n", args_info.optA_arg);
 
24
    }
 
25
 
 
26
  if (args_info.optAmul_given)
 
27
    {
 
28
      printf("optAmul given %d time(s)\n", args_info.optAmul_given);
 
29
      for (i = 0; i < args_info.optAmul_given; ++i)
 
30
        printf("optAmul arg: %s\n", 
 
31
               (args_info.optAmul_arg[i] ? args_info.optAmul_arg[i] : "(null)"));
 
32
    }
 
33
 
 
34
  test_modes_cmd_parser_free (&args_info);
 
35
 
 
36
  return 0;
 
37
}