~ubuntu-branches/ubuntu/trusty/wdq2wav/trusty-proposed

« back to all changes in this revision

Viewing changes to msvc/wdq2wav/getopt1.c

  • Committer: Bazaar Package Importer
  • Author(s): Kevin M. Rosenberg
  • Date: 2007-09-08 18:50:57 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070908185057-gs71c985g0o7zh67
Tags: 0.8.1-1
New upsgream

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
#include <stdlib.h>
60
60
#endif
61
61
 
62
 
#ifndef NULL
 
62
#ifndef NULL
63
63
#define NULL 0
64
64
#endif
65
65
 
91
91
}
92
92
 
93
93
 
94
 
#endif  /* Not ELIDE_CODE.  */
 
94
#endif  /* Not ELIDE_CODE.  */
95
95
 
96
96
#ifdef TEST
97
97
 
111
111
      int option_index = 0;
112
112
      static struct option long_options[] =
113
113
      {
114
 
        {"add", 1, 0, 0},
115
 
        {"append", 0, 0, 0},
116
 
        {"delete", 1, 0, 0},
117
 
        {"verbose", 0, 0, 0},
118
 
        {"create", 0, 0, 0},
119
 
        {"file", 1, 0, 0},
120
 
        {0, 0, 0, 0}
 
114
        {"add", 1, 0, 0},
 
115
        {"append", 0, 0, 0},
 
116
        {"delete", 1, 0, 0},
 
117
        {"verbose", 0, 0, 0},
 
118
        {"create", 0, 0, 0},
 
119
        {"file", 1, 0, 0},
 
120
        {0, 0, 0, 0}
121
121
      };
122
122
 
123
123
      c = getopt_long (argc, argv, "abc:d:0123456789",
124
 
                       long_options, &option_index);
 
124
                       long_options, &option_index);
125
125
      if (c == -1)
126
 
        break;
 
126
        break;
127
127
 
128
128
      switch (c)
129
 
        {
130
 
        case 0:
131
 
          printf ("option %s", long_options[option_index].name);
132
 
          if (optarg)
133
 
            printf (" with arg %s", optarg);
134
 
          printf ("\n");
135
 
          break;
136
 
 
137
 
        case '0':
138
 
        case '1':
139
 
        case '2':
140
 
        case '3':
141
 
        case '4':
142
 
        case '5':
143
 
        case '6':
144
 
        case '7':
145
 
        case '8':
146
 
        case '9':
147
 
          if (digit_optind != 0 && digit_optind != this_option_optind)
148
 
            printf ("digits occur in two different argv-elements.\n");
149
 
          digit_optind = this_option_optind;
150
 
          printf ("option %c\n", c);
151
 
          break;
152
 
 
153
 
        case 'a':
154
 
          printf ("option a\n");
155
 
          break;
156
 
 
157
 
        case 'b':
158
 
          printf ("option b\n");
159
 
          break;
160
 
 
161
 
        case 'c':
162
 
          printf ("option c with value `%s'\n", optarg);
163
 
          break;
164
 
 
165
 
        case 'd':
166
 
          printf ("option d with value `%s'\n", optarg);
167
 
          break;
168
 
 
169
 
        case '?':
170
 
          break;
171
 
 
172
 
        default:
173
 
          printf ("?? getopt returned character code 0%o ??\n", c);
174
 
        }
 
129
        {
 
130
        case 0:
 
131
          printf ("option %s", long_options[option_index].name);
 
132
          if (optarg)
 
133
            printf (" with arg %s", optarg);
 
134
          printf ("\n");
 
135
          break;
 
136
 
 
137
        case '0':
 
138
        case '1':
 
139
        case '2':
 
140
        case '3':
 
141
        case '4':
 
142
        case '5':
 
143
        case '6':
 
144
        case '7':
 
145
        case '8':
 
146
        case '9':
 
147
          if (digit_optind != 0 && digit_optind != this_option_optind)
 
148
            printf ("digits occur in two different argv-elements.\n");
 
149
          digit_optind = this_option_optind;
 
150
          printf ("option %c\n", c);
 
151
          break;
 
152
 
 
153
        case 'a':
 
154
          printf ("option a\n");
 
155
          break;
 
156
 
 
157
        case 'b':
 
158
          printf ("option b\n");
 
159
          break;
 
160
 
 
161
        case 'c':
 
162
          printf ("option c with value `%s'\n", optarg);
 
163
          break;
 
164
 
 
165
        case 'd':
 
166
          printf ("option d with value `%s'\n", optarg);
 
167
          break;
 
168
 
 
169
        case '?':
 
170
          break;
 
171
 
 
172
        default:
 
173
          printf ("?? getopt returned character code 0%o ??\n", c);
 
174
        }
175
175
    }
176
176
 
177
177
  if (optind < argc)
178
178
    {
179
179
      printf ("non-option ARGV-elements: ");
180
180
      while (optind < argc)
181
 
        printf ("%s ", argv[optind++]);
 
181
        printf ("%s ", argv[optind++]);
182
182
      printf ("\n");
183
183
    }
184
184