| 1 |
|
/* |
| 2 |
< |
File autogenerated by gengetopt version 2.22 |
| 2 |
> |
File autogenerated by gengetopt version 2.22.4 |
| 3 |
|
generated with the following command: |
| 4 |
|
gengetopt -F Dump2XYZCmd -u |
| 5 |
|
|
| 17 |
|
#include <stdlib.h> |
| 18 |
|
#include <string.h> |
| 19 |
|
|
| 20 |
< |
#include "getopt.h" |
| 20 |
> |
#ifndef FIX_UNUSED |
| 21 |
> |
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */ |
| 22 |
> |
#endif |
| 23 |
|
|
| 24 |
+ |
#include <getopt.h> |
| 25 |
+ |
|
| 26 |
|
#include "Dump2XYZCmd.h" |
| 27 |
|
|
| 28 |
|
const char *gengetopt_args_info_purpose = ""; |
| 68 |
|
void clear_args (struct gengetopt_args_info *args_info); |
| 69 |
|
|
| 70 |
|
static int |
| 71 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 71 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
| 72 |
|
struct cmdline_parser_params *params, const char *additional_error); |
| 73 |
|
|
| 74 |
|
static int |
| 106 |
|
static |
| 107 |
|
void clear_args (struct gengetopt_args_info *args_info) |
| 108 |
|
{ |
| 109 |
+ |
FIX_UNUSED (args_info); |
| 110 |
|
args_info->input_arg = NULL; |
| 111 |
|
args_info->input_orig = NULL; |
| 112 |
|
args_info->output_arg = NULL; |
| 170 |
|
void |
| 171 |
|
cmdline_parser_print_version (void) |
| 172 |
|
{ |
| 173 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
| 173 |
> |
printf ("%s %s\n", |
| 174 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
| 175 |
> |
CMDLINE_PARSER_VERSION); |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
static void print_help_common(void) { |
| 187 |
|
printf("\n"); |
| 188 |
|
|
| 189 |
|
if (strlen(gengetopt_args_info_description) > 0) |
| 190 |
< |
printf("%s\n", gengetopt_args_info_description); |
| 190 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
void |
| 206 |
|
clear_args (args_info); |
| 207 |
|
init_args_info (args_info); |
| 208 |
|
|
| 209 |
< |
args_info->inputs = NULL; |
| 209 |
> |
args_info->inputs = 0; |
| 210 |
|
args_info->inputs_num = 0; |
| 211 |
|
} |
| 212 |
|
|
| 274 |
|
|
| 275 |
|
|
| 276 |
|
static void |
| 277 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
| 277 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
| 278 |
|
{ |
| 279 |
+ |
FIX_UNUSED (values); |
| 280 |
|
if (arg) { |
| 281 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
| 282 |
|
} else { |
| 374 |
|
char * |
| 375 |
|
gengetopt_strdup (const char *s) |
| 376 |
|
{ |
| 377 |
< |
char *result = NULL; |
| 377 |
> |
char *result = 0; |
| 378 |
|
if (!s) |
| 379 |
|
return result; |
| 380 |
|
|
| 386 |
|
} |
| 387 |
|
|
| 388 |
|
int |
| 389 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
| 389 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
| 390 |
|
{ |
| 391 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
| 392 |
|
} |
| 393 |
|
|
| 394 |
|
int |
| 395 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 395 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
| 396 |
|
struct cmdline_parser_params *params) |
| 397 |
|
{ |
| 398 |
|
int result; |
| 399 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
| 399 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
| 400 |
|
|
| 401 |
|
if (result == EXIT_FAILURE) |
| 402 |
|
{ |
| 408 |
|
} |
| 409 |
|
|
| 410 |
|
int |
| 411 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
| 411 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
| 412 |
|
{ |
| 413 |
|
int result; |
| 414 |
|
struct cmdline_parser_params params; |
| 419 |
|
params.check_ambiguity = 0; |
| 420 |
|
params.print_errors = 1; |
| 421 |
|
|
| 422 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
| 422 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
| 423 |
|
|
| 424 |
|
if (result == EXIT_FAILURE) |
| 425 |
|
{ |
| 435 |
|
{ |
| 436 |
|
int result = EXIT_SUCCESS; |
| 437 |
|
|
| 438 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
| 438 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
| 439 |
|
result = EXIT_FAILURE; |
| 440 |
|
|
| 441 |
|
if (result == EXIT_FAILURE) |
| 451 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
| 452 |
|
{ |
| 453 |
|
int error = 0; |
| 454 |
+ |
FIX_UNUSED (additional_error); |
| 455 |
|
|
| 456 |
|
/* checks for required options */ |
| 457 |
|
if (! args_info->input_given) |
| 490 |
|
static |
| 491 |
|
int update_arg(void *field, char **orig_field, |
| 492 |
|
unsigned int *field_given, unsigned int *prev_given, |
| 493 |
< |
char *value, char *possible_values[], const char *default_value, |
| 493 |
> |
char *value, const char *possible_values[], |
| 494 |
> |
const char *default_value, |
| 495 |
|
cmdline_parser_arg_type arg_type, |
| 496 |
|
int check_ambiguity, int override, |
| 497 |
|
int no_free, int multiple_option, |
| 502 |
|
const char *val = value; |
| 503 |
|
int found; |
| 504 |
|
char **string_field; |
| 505 |
+ |
FIX_UNUSED (field); |
| 506 |
|
|
| 507 |
|
stop_char = 0; |
| 508 |
|
found = 0; |
| 520 |
|
return 1; /* failure */ |
| 521 |
|
} |
| 522 |
|
|
| 523 |
+ |
FIX_UNUSED (default_value); |
| 524 |
|
|
| 525 |
|
if (field_given && *field_given && ! override) |
| 526 |
|
return 0; |
| 584 |
|
|
| 585 |
|
|
| 586 |
|
int |
| 587 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 587 |
> |
cmdline_parser_internal ( |
| 588 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
| 589 |
|
struct cmdline_parser_params *params, const char *additional_error) |
| 590 |
|
{ |
| 591 |
|
int c; /* Character of the parsed option. */ |
| 641 |
|
{ "forces", 0, NULL, 'f' }, |
| 642 |
|
{ "vectors", 0, NULL, 'u' }, |
| 643 |
|
{ "charges", 0, NULL, 'c' }, |
| 644 |
< |
{ NULL, 0, NULL, 0 } |
| 644 |
> |
{ 0, 0, 0, 0 } |
| 645 |
|
}; |
| 646 |
|
|
| 647 |
|
c = getopt_long (argc, argv, "hVi:o:n:wmzrts:bvfuc", long_options, &option_index); |