1 |
tim |
12 |
/* |
2 |
gezelter |
1067 |
File autogenerated by gengetopt version 2.16 |
3 |
tim |
12 |
generated with the following command: |
4 |
gezelter |
1067 |
gengetopt -F simpleBuilderCmd --unamed-opts |
5 |
tim |
12 |
|
6 |
|
|
The developers of gengetopt consider the fixed text that goes in all |
7 |
|
|
gengetopt output files to be in the public domain: |
8 |
|
|
we make no copyright claims on it. |
9 |
|
|
*/ |
10 |
|
|
|
11 |
gezelter |
1067 |
/* If we use autoconf. */ |
12 |
|
|
#ifdef HAVE_CONFIG_H |
13 |
|
|
#include "config.h" |
14 |
|
|
#endif |
15 |
tim |
12 |
|
16 |
|
|
#include <stdio.h> |
17 |
|
|
#include <stdlib.h> |
18 |
|
|
#include <string.h> |
19 |
|
|
|
20 |
|
|
#include "getopt.h" |
21 |
|
|
|
22 |
gezelter |
1067 |
#include "simpleBuilderCmd.h" |
23 |
tim |
12 |
|
24 |
gezelter |
1067 |
static |
25 |
|
|
void clear_given (struct gengetopt_args_info *args_info); |
26 |
|
|
static |
27 |
|
|
void clear_args (struct gengetopt_args_info *args_info); |
28 |
|
|
|
29 |
|
|
static int |
30 |
|
|
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error); |
31 |
|
|
|
32 |
|
|
static int |
33 |
|
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); |
34 |
|
|
|
35 |
|
|
static char * |
36 |
|
|
gengetopt_strdup (const char *s); |
37 |
|
|
|
38 |
|
|
static |
39 |
|
|
void clear_given (struct gengetopt_args_info *args_info) |
40 |
|
|
{ |
41 |
|
|
args_info->help_given = 0 ; |
42 |
|
|
args_info->version_given = 0 ; |
43 |
|
|
args_info->output_given = 0 ; |
44 |
|
|
args_info->density_given = 0 ; |
45 |
|
|
args_info->nx_given = 0 ; |
46 |
|
|
args_info->ny_given = 0 ; |
47 |
|
|
args_info->nz_given = 0 ; |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
static |
51 |
|
|
void clear_args (struct gengetopt_args_info *args_info) |
52 |
|
|
{ |
53 |
|
|
args_info->output_arg = NULL; |
54 |
|
|
args_info->output_orig = NULL; |
55 |
|
|
args_info->density_orig = NULL; |
56 |
|
|
args_info->nx_orig = NULL; |
57 |
|
|
args_info->ny_orig = NULL; |
58 |
|
|
args_info->nz_orig = NULL; |
59 |
|
|
|
60 |
|
|
} |
61 |
|
|
|
62 |
tim |
12 |
void |
63 |
|
|
cmdline_parser_print_version (void) |
64 |
|
|
{ |
65 |
|
|
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
void |
69 |
|
|
cmdline_parser_print_help (void) |
70 |
|
|
{ |
71 |
|
|
cmdline_parser_print_version (); |
72 |
gezelter |
1067 |
printf("\nUsage: simpleBuilder [OPTIONS]... [FILES]...\n\n"); |
73 |
|
|
printf("%s\n"," -h, --help Print help and exit"); |
74 |
|
|
printf("%s\n"," -V, --version Print version and exit"); |
75 |
|
|
printf("%s\n"," -o, --output=STRING Output file name"); |
76 |
|
|
printf("%s\n"," --density=DOUBLE density (g/cm^3)"); |
77 |
|
|
printf("%s\n"," --nx=INT number of unit cells in x"); |
78 |
|
|
printf("%s\n"," --ny=INT number of unit cells in y"); |
79 |
|
|
printf("%s\n"," --nz=INT number of unit cells in z"); |
80 |
|
|
|
81 |
tim |
12 |
} |
82 |
|
|
|
83 |
gezelter |
1067 |
void |
84 |
|
|
cmdline_parser_init (struct gengetopt_args_info *args_info) |
85 |
|
|
{ |
86 |
|
|
clear_given (args_info); |
87 |
|
|
clear_args (args_info); |
88 |
tim |
12 |
|
89 |
gezelter |
1067 |
args_info->inputs = NULL; |
90 |
|
|
args_info->inputs_num = 0; |
91 |
|
|
} |
92 |
tim |
12 |
|
93 |
gezelter |
1067 |
static void |
94 |
|
|
cmdline_parser_release (struct gengetopt_args_info *args_info) |
95 |
|
|
{ |
96 |
|
|
|
97 |
|
|
unsigned int i; |
98 |
|
|
if (args_info->output_arg) |
99 |
|
|
{ |
100 |
|
|
free (args_info->output_arg); /* free previous argument */ |
101 |
|
|
args_info->output_arg = 0; |
102 |
|
|
} |
103 |
|
|
if (args_info->output_orig) |
104 |
|
|
{ |
105 |
|
|
free (args_info->output_orig); /* free previous argument */ |
106 |
|
|
args_info->output_orig = 0; |
107 |
|
|
} |
108 |
|
|
if (args_info->density_orig) |
109 |
|
|
{ |
110 |
|
|
free (args_info->density_orig); /* free previous argument */ |
111 |
|
|
args_info->density_orig = 0; |
112 |
|
|
} |
113 |
|
|
if (args_info->nx_orig) |
114 |
|
|
{ |
115 |
|
|
free (args_info->nx_orig); /* free previous argument */ |
116 |
|
|
args_info->nx_orig = 0; |
117 |
|
|
} |
118 |
|
|
if (args_info->ny_orig) |
119 |
|
|
{ |
120 |
|
|
free (args_info->ny_orig); /* free previous argument */ |
121 |
|
|
args_info->ny_orig = 0; |
122 |
|
|
} |
123 |
|
|
if (args_info->nz_orig) |
124 |
|
|
{ |
125 |
|
|
free (args_info->nz_orig); /* free previous argument */ |
126 |
|
|
args_info->nz_orig = 0; |
127 |
|
|
} |
128 |
|
|
|
129 |
|
|
for (i = 0; i < args_info->inputs_num; ++i) |
130 |
|
|
free (args_info->inputs [i]); |
131 |
|
|
|
132 |
|
|
if (args_info->inputs_num) |
133 |
|
|
free (args_info->inputs); |
134 |
|
|
|
135 |
|
|
clear_given (args_info); |
136 |
|
|
} |
137 |
|
|
|
138 |
|
|
int |
139 |
|
|
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) |
140 |
|
|
{ |
141 |
|
|
FILE *outfile; |
142 |
|
|
int i = 0; |
143 |
|
|
|
144 |
|
|
outfile = fopen(filename, "w"); |
145 |
|
|
|
146 |
|
|
if (!outfile) |
147 |
|
|
{ |
148 |
|
|
fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); |
149 |
|
|
return EXIT_FAILURE; |
150 |
|
|
} |
151 |
|
|
|
152 |
|
|
if (args_info->help_given) { |
153 |
|
|
fprintf(outfile, "%s\n", "help"); |
154 |
|
|
} |
155 |
|
|
if (args_info->version_given) { |
156 |
|
|
fprintf(outfile, "%s\n", "version"); |
157 |
|
|
} |
158 |
|
|
if (args_info->output_given) { |
159 |
|
|
if (args_info->output_orig) { |
160 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); |
161 |
|
|
} else { |
162 |
|
|
fprintf(outfile, "%s\n", "output"); |
163 |
|
|
} |
164 |
|
|
} |
165 |
|
|
if (args_info->density_given) { |
166 |
|
|
if (args_info->density_orig) { |
167 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "density", args_info->density_orig); |
168 |
|
|
} else { |
169 |
|
|
fprintf(outfile, "%s\n", "density"); |
170 |
|
|
} |
171 |
|
|
} |
172 |
|
|
if (args_info->nx_given) { |
173 |
|
|
if (args_info->nx_orig) { |
174 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "nx", args_info->nx_orig); |
175 |
|
|
} else { |
176 |
|
|
fprintf(outfile, "%s\n", "nx"); |
177 |
|
|
} |
178 |
|
|
} |
179 |
|
|
if (args_info->ny_given) { |
180 |
|
|
if (args_info->ny_orig) { |
181 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "ny", args_info->ny_orig); |
182 |
|
|
} else { |
183 |
|
|
fprintf(outfile, "%s\n", "ny"); |
184 |
|
|
} |
185 |
|
|
} |
186 |
|
|
if (args_info->nz_given) { |
187 |
|
|
if (args_info->nz_orig) { |
188 |
|
|
fprintf(outfile, "%s=\"%s\"\n", "nz", args_info->nz_orig); |
189 |
|
|
} else { |
190 |
|
|
fprintf(outfile, "%s\n", "nz"); |
191 |
|
|
} |
192 |
|
|
} |
193 |
|
|
|
194 |
|
|
fclose (outfile); |
195 |
|
|
|
196 |
|
|
i = EXIT_SUCCESS; |
197 |
|
|
return i; |
198 |
|
|
} |
199 |
|
|
|
200 |
|
|
void |
201 |
|
|
cmdline_parser_free (struct gengetopt_args_info *args_info) |
202 |
|
|
{ |
203 |
|
|
cmdline_parser_release (args_info); |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
|
207 |
tim |
12 |
/* gengetopt_strdup() */ |
208 |
|
|
/* strdup.c replacement of strdup, which is not standard */ |
209 |
|
|
char * |
210 |
|
|
gengetopt_strdup (const char *s) |
211 |
|
|
{ |
212 |
gezelter |
1067 |
char *result = NULL; |
213 |
|
|
if (!s) |
214 |
|
|
return result; |
215 |
|
|
|
216 |
|
|
result = (char*)malloc(strlen(s) + 1); |
217 |
tim |
12 |
if (result == (char*)0) |
218 |
|
|
return (char*)0; |
219 |
|
|
strcpy(result, s); |
220 |
|
|
return result; |
221 |
|
|
} |
222 |
|
|
|
223 |
|
|
int |
224 |
|
|
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
225 |
|
|
{ |
226 |
gezelter |
1067 |
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
227 |
|
|
} |
228 |
|
|
|
229 |
|
|
int |
230 |
|
|
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
231 |
|
|
{ |
232 |
|
|
int result; |
233 |
|
|
|
234 |
|
|
result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); |
235 |
|
|
|
236 |
|
|
if (result == EXIT_FAILURE) |
237 |
|
|
{ |
238 |
|
|
cmdline_parser_free (args_info); |
239 |
|
|
exit (EXIT_FAILURE); |
240 |
|
|
} |
241 |
|
|
|
242 |
|
|
return result; |
243 |
|
|
} |
244 |
|
|
|
245 |
|
|
int |
246 |
|
|
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) |
247 |
|
|
{ |
248 |
|
|
int result = EXIT_SUCCESS; |
249 |
|
|
|
250 |
|
|
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
251 |
|
|
result = EXIT_FAILURE; |
252 |
|
|
|
253 |
|
|
if (result == EXIT_FAILURE) |
254 |
|
|
{ |
255 |
|
|
cmdline_parser_free (args_info); |
256 |
|
|
exit (EXIT_FAILURE); |
257 |
|
|
} |
258 |
|
|
|
259 |
|
|
return result; |
260 |
|
|
} |
261 |
|
|
|
262 |
|
|
int |
263 |
|
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
264 |
|
|
{ |
265 |
|
|
int error = 0; |
266 |
|
|
|
267 |
|
|
if (! args_info->output_given) |
268 |
|
|
{ |
269 |
|
|
fprintf (stderr, "%s: '--output' ('-o') option required%s\n", prog_name, (additional_error ? additional_error : "")); |
270 |
|
|
error = 1; |
271 |
|
|
} |
272 |
|
|
if (! args_info->density_given) |
273 |
|
|
{ |
274 |
|
|
fprintf (stderr, "%s: '--density' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
275 |
|
|
error = 1; |
276 |
|
|
} |
277 |
|
|
if (! args_info->nx_given) |
278 |
|
|
{ |
279 |
|
|
fprintf (stderr, "%s: '--nx' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
280 |
|
|
error = 1; |
281 |
|
|
} |
282 |
|
|
if (! args_info->ny_given) |
283 |
|
|
{ |
284 |
|
|
fprintf (stderr, "%s: '--ny' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
285 |
|
|
error = 1; |
286 |
|
|
} |
287 |
|
|
if (! args_info->nz_given) |
288 |
|
|
{ |
289 |
|
|
fprintf (stderr, "%s: '--nz' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
290 |
|
|
error = 1; |
291 |
|
|
} |
292 |
|
|
|
293 |
|
|
return error; |
294 |
|
|
} |
295 |
|
|
|
296 |
|
|
int |
297 |
|
|
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error) |
298 |
|
|
{ |
299 |
tim |
12 |
int c; /* Character of the parsed option. */ |
300 |
|
|
|
301 |
gezelter |
1067 |
int error = 0; |
302 |
|
|
struct gengetopt_args_info local_args_info; |
303 |
tim |
12 |
|
304 |
gezelter |
1067 |
if (initialize) |
305 |
|
|
cmdline_parser_init (args_info); |
306 |
tim |
12 |
|
307 |
gezelter |
1067 |
cmdline_parser_init (&local_args_info); |
308 |
tim |
12 |
|
309 |
|
|
optarg = 0; |
310 |
gezelter |
1067 |
optind = 0; |
311 |
tim |
12 |
opterr = 1; |
312 |
|
|
optopt = '?'; |
313 |
|
|
|
314 |
|
|
while (1) |
315 |
|
|
{ |
316 |
|
|
int option_index = 0; |
317 |
|
|
char *stop_char; |
318 |
|
|
|
319 |
|
|
static struct option long_options[] = { |
320 |
|
|
{ "help", 0, NULL, 'h' }, |
321 |
|
|
{ "version", 0, NULL, 'V' }, |
322 |
|
|
{ "output", 1, NULL, 'o' }, |
323 |
|
|
{ "density", 1, NULL, 0 }, |
324 |
|
|
{ "nx", 1, NULL, 0 }, |
325 |
|
|
{ "ny", 1, NULL, 0 }, |
326 |
|
|
{ "nz", 1, NULL, 0 }, |
327 |
|
|
{ NULL, 0, NULL, 0 } |
328 |
|
|
}; |
329 |
|
|
|
330 |
|
|
stop_char = 0; |
331 |
|
|
c = getopt_long (argc, argv, "hVo:", long_options, &option_index); |
332 |
|
|
|
333 |
|
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
334 |
|
|
|
335 |
|
|
switch (c) |
336 |
|
|
{ |
337 |
|
|
case 'h': /* Print help and exit. */ |
338 |
|
|
cmdline_parser_print_help (); |
339 |
gezelter |
1067 |
cmdline_parser_free (&local_args_info); |
340 |
tim |
12 |
exit (EXIT_SUCCESS); |
341 |
|
|
|
342 |
|
|
case 'V': /* Print version and exit. */ |
343 |
|
|
cmdline_parser_print_version (); |
344 |
gezelter |
1067 |
cmdline_parser_free (&local_args_info); |
345 |
tim |
12 |
exit (EXIT_SUCCESS); |
346 |
|
|
|
347 |
|
|
case 'o': /* Output file name. */ |
348 |
gezelter |
1067 |
if (local_args_info.output_given) |
349 |
tim |
12 |
{ |
350 |
gezelter |
1067 |
fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
351 |
|
|
goto failure; |
352 |
tim |
12 |
} |
353 |
gezelter |
1067 |
if (args_info->output_given && ! override) |
354 |
|
|
continue; |
355 |
|
|
local_args_info.output_given = 1; |
356 |
tim |
12 |
args_info->output_given = 1; |
357 |
gezelter |
1067 |
if (args_info->output_arg) |
358 |
|
|
free (args_info->output_arg); /* free previous string */ |
359 |
tim |
12 |
args_info->output_arg = gengetopt_strdup (optarg); |
360 |
gezelter |
1067 |
if (args_info->output_orig) |
361 |
|
|
free (args_info->output_orig); /* free previous string */ |
362 |
|
|
args_info->output_orig = gengetopt_strdup (optarg); |
363 |
tim |
12 |
break; |
364 |
|
|
|
365 |
|
|
|
366 |
|
|
case 0: /* Long option with no short option */ |
367 |
|
|
/* density (g/cm^3). */ |
368 |
gezelter |
1067 |
if (strcmp (long_options[option_index].name, "density") == 0) |
369 |
|
|
{ |
370 |
|
|
if (local_args_info.density_given) |
371 |
|
|
{ |
372 |
|
|
fprintf (stderr, "%s: `--density' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
373 |
|
|
goto failure; |
374 |
|
|
} |
375 |
|
|
if (args_info->density_given && ! override) |
376 |
|
|
continue; |
377 |
|
|
local_args_info.density_given = 1; |
378 |
|
|
args_info->density_given = 1; |
379 |
|
|
args_info->density_arg = strtod (optarg, &stop_char); |
380 |
|
|
if (!(stop_char && *stop_char == '\0')) { |
381 |
|
|
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
382 |
|
|
goto failure; |
383 |
|
|
} |
384 |
|
|
if (args_info->density_orig) |
385 |
|
|
free (args_info->density_orig); /* free previous string */ |
386 |
|
|
args_info->density_orig = gengetopt_strdup (optarg); |
387 |
|
|
} |
388 |
tim |
12 |
/* number of unit cells in x. */ |
389 |
|
|
else if (strcmp (long_options[option_index].name, "nx") == 0) |
390 |
gezelter |
1067 |
{ |
391 |
|
|
if (local_args_info.nx_given) |
392 |
|
|
{ |
393 |
|
|
fprintf (stderr, "%s: `--nx' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
394 |
|
|
goto failure; |
395 |
|
|
} |
396 |
|
|
if (args_info->nx_given && ! override) |
397 |
|
|
continue; |
398 |
|
|
local_args_info.nx_given = 1; |
399 |
|
|
args_info->nx_given = 1; |
400 |
|
|
args_info->nx_arg = strtol (optarg, &stop_char, 0); |
401 |
|
|
if (!(stop_char && *stop_char == '\0')) { |
402 |
|
|
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
403 |
|
|
goto failure; |
404 |
|
|
} |
405 |
|
|
if (args_info->nx_orig) |
406 |
|
|
free (args_info->nx_orig); /* free previous string */ |
407 |
|
|
args_info->nx_orig = gengetopt_strdup (optarg); |
408 |
|
|
} |
409 |
tim |
12 |
/* number of unit cells in y. */ |
410 |
|
|
else if (strcmp (long_options[option_index].name, "ny") == 0) |
411 |
gezelter |
1067 |
{ |
412 |
|
|
if (local_args_info.ny_given) |
413 |
|
|
{ |
414 |
|
|
fprintf (stderr, "%s: `--ny' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
415 |
|
|
goto failure; |
416 |
|
|
} |
417 |
|
|
if (args_info->ny_given && ! override) |
418 |
|
|
continue; |
419 |
|
|
local_args_info.ny_given = 1; |
420 |
|
|
args_info->ny_given = 1; |
421 |
|
|
args_info->ny_arg = strtol (optarg, &stop_char, 0); |
422 |
|
|
if (!(stop_char && *stop_char == '\0')) { |
423 |
|
|
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
424 |
|
|
goto failure; |
425 |
|
|
} |
426 |
|
|
if (args_info->ny_orig) |
427 |
|
|
free (args_info->ny_orig); /* free previous string */ |
428 |
|
|
args_info->ny_orig = gengetopt_strdup (optarg); |
429 |
|
|
} |
430 |
tim |
12 |
/* number of unit cells in z. */ |
431 |
|
|
else if (strcmp (long_options[option_index].name, "nz") == 0) |
432 |
gezelter |
1067 |
{ |
433 |
|
|
if (local_args_info.nz_given) |
434 |
|
|
{ |
435 |
|
|
fprintf (stderr, "%s: `--nz' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
436 |
|
|
goto failure; |
437 |
|
|
} |
438 |
|
|
if (args_info->nz_given && ! override) |
439 |
|
|
continue; |
440 |
|
|
local_args_info.nz_given = 1; |
441 |
|
|
args_info->nz_given = 1; |
442 |
|
|
args_info->nz_arg = strtol (optarg, &stop_char, 0); |
443 |
|
|
if (!(stop_char && *stop_char == '\0')) { |
444 |
|
|
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
445 |
|
|
goto failure; |
446 |
|
|
} |
447 |
|
|
if (args_info->nz_orig) |
448 |
|
|
free (args_info->nz_orig); /* free previous string */ |
449 |
|
|
args_info->nz_orig = gengetopt_strdup (optarg); |
450 |
|
|
} |
451 |
tim |
12 |
|
452 |
gezelter |
1067 |
break; |
453 |
tim |
12 |
case '?': /* Invalid option. */ |
454 |
|
|
/* `getopt_long' already printed an error message. */ |
455 |
gezelter |
1067 |
goto failure; |
456 |
tim |
12 |
|
457 |
|
|
default: /* bug: option not considered. */ |
458 |
gezelter |
1067 |
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); |
459 |
tim |
12 |
abort (); |
460 |
|
|
} /* switch */ |
461 |
|
|
} /* while */ |
462 |
|
|
|
463 |
|
|
|
464 |
gezelter |
1067 |
|
465 |
|
|
if (check_required) |
466 |
tim |
12 |
{ |
467 |
gezelter |
1067 |
error += cmdline_parser_required2 (args_info, argv[0], additional_error); |
468 |
tim |
12 |
} |
469 |
|
|
|
470 |
gezelter |
1067 |
cmdline_parser_release (&local_args_info); |
471 |
|
|
|
472 |
|
|
if ( error ) |
473 |
|
|
return (EXIT_FAILURE); |
474 |
|
|
|
475 |
tim |
12 |
if (optind < argc) |
476 |
|
|
{ |
477 |
|
|
int i = 0 ; |
478 |
gezelter |
1067 |
|
479 |
tim |
12 |
args_info->inputs_num = argc - optind ; |
480 |
gezelter |
1067 |
args_info->inputs = |
481 |
tim |
12 |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
482 |
|
|
while (optind < argc) |
483 |
gezelter |
1067 |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; |
484 |
tim |
12 |
} |
485 |
gezelter |
1067 |
|
486 |
|
|
return 0; |
487 |
|
|
|
488 |
|
|
failure: |
489 |
tim |
12 |
|
490 |
gezelter |
1067 |
cmdline_parser_release (&local_args_info); |
491 |
|
|
return (EXIT_FAILURE); |
492 |
tim |
12 |
} |