| 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 |
+ |
#ifdef WIN32 |
| 25 |
+ |
#include "utils/wingetopt.h" |
| 26 |
+ |
#else |
| 27 |
+ |
#include <getopt.h> |
| 28 |
+ |
#endif |
| 29 |
+ |
|
| 30 |
|
#include "Dump2XYZCmd.h" |
| 31 |
|
|
| 32 |
|
const char *gengetopt_args_info_purpose = ""; |
| 72 |
|
void clear_args (struct gengetopt_args_info *args_info); |
| 73 |
|
|
| 74 |
|
static int |
| 75 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 75 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
| 76 |
|
struct cmdline_parser_params *params, const char *additional_error); |
| 77 |
|
|
| 78 |
|
static int |
| 110 |
|
static |
| 111 |
|
void clear_args (struct gengetopt_args_info *args_info) |
| 112 |
|
{ |
| 113 |
+ |
FIX_UNUSED (args_info); |
| 114 |
|
args_info->input_arg = NULL; |
| 115 |
|
args_info->input_orig = NULL; |
| 116 |
|
args_info->output_arg = NULL; |
| 174 |
|
void |
| 175 |
|
cmdline_parser_print_version (void) |
| 176 |
|
{ |
| 177 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
| 177 |
> |
printf ("%s %s\n", |
| 178 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
| 179 |
> |
CMDLINE_PARSER_VERSION); |
| 180 |
|
} |
| 181 |
|
|
| 182 |
|
static void print_help_common(void) { |
| 191 |
|
printf("\n"); |
| 192 |
|
|
| 193 |
|
if (strlen(gengetopt_args_info_description) > 0) |
| 194 |
< |
printf("%s\n", gengetopt_args_info_description); |
| 194 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
| 195 |
|
} |
| 196 |
|
|
| 197 |
|
void |
| 210 |
|
clear_args (args_info); |
| 211 |
|
init_args_info (args_info); |
| 212 |
|
|
| 213 |
< |
args_info->inputs = NULL; |
| 213 |
> |
args_info->inputs = 0; |
| 214 |
|
args_info->inputs_num = 0; |
| 215 |
|
} |
| 216 |
|
|
| 278 |
|
|
| 279 |
|
|
| 280 |
|
static void |
| 281 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
| 281 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
| 282 |
|
{ |
| 283 |
+ |
FIX_UNUSED (values); |
| 284 |
|
if (arg) { |
| 285 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
| 286 |
|
} else { |
| 378 |
|
char * |
| 379 |
|
gengetopt_strdup (const char *s) |
| 380 |
|
{ |
| 381 |
< |
char *result = NULL; |
| 381 |
> |
char *result = 0; |
| 382 |
|
if (!s) |
| 383 |
|
return result; |
| 384 |
|
|
| 390 |
|
} |
| 391 |
|
|
| 392 |
|
int |
| 393 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
| 393 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
| 394 |
|
{ |
| 395 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
| 396 |
|
} |
| 397 |
|
|
| 398 |
|
int |
| 399 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 399 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
| 400 |
|
struct cmdline_parser_params *params) |
| 401 |
|
{ |
| 402 |
|
int result; |
| 403 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
| 403 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
| 404 |
|
|
| 405 |
|
if (result == EXIT_FAILURE) |
| 406 |
|
{ |
| 412 |
|
} |
| 413 |
|
|
| 414 |
|
int |
| 415 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
| 415 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
| 416 |
|
{ |
| 417 |
|
int result; |
| 418 |
|
struct cmdline_parser_params params; |
| 423 |
|
params.check_ambiguity = 0; |
| 424 |
|
params.print_errors = 1; |
| 425 |
|
|
| 426 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
| 426 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
| 427 |
|
|
| 428 |
|
if (result == EXIT_FAILURE) |
| 429 |
|
{ |
| 439 |
|
{ |
| 440 |
|
int result = EXIT_SUCCESS; |
| 441 |
|
|
| 442 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
| 442 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
| 443 |
|
result = EXIT_FAILURE; |
| 444 |
|
|
| 445 |
|
if (result == EXIT_FAILURE) |
| 455 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
| 456 |
|
{ |
| 457 |
|
int error = 0; |
| 458 |
+ |
FIX_UNUSED (additional_error); |
| 459 |
|
|
| 460 |
|
/* checks for required options */ |
| 461 |
|
if (! args_info->input_given) |
| 494 |
|
static |
| 495 |
|
int update_arg(void *field, char **orig_field, |
| 496 |
|
unsigned int *field_given, unsigned int *prev_given, |
| 497 |
< |
char *value, char *possible_values[], const char *default_value, |
| 497 |
> |
char *value, const char *possible_values[], |
| 498 |
> |
const char *default_value, |
| 499 |
|
cmdline_parser_arg_type arg_type, |
| 500 |
|
int check_ambiguity, int override, |
| 501 |
|
int no_free, int multiple_option, |
| 506 |
|
const char *val = value; |
| 507 |
|
int found; |
| 508 |
|
char **string_field; |
| 509 |
+ |
FIX_UNUSED (field); |
| 510 |
|
|
| 511 |
|
stop_char = 0; |
| 512 |
|
found = 0; |
| 524 |
|
return 1; /* failure */ |
| 525 |
|
} |
| 526 |
|
|
| 527 |
+ |
FIX_UNUSED (default_value); |
| 528 |
|
|
| 529 |
|
if (field_given && *field_given && ! override) |
| 530 |
|
return 0; |
| 588 |
|
|
| 589 |
|
|
| 590 |
|
int |
| 591 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 591 |
> |
cmdline_parser_internal ( |
| 592 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
| 593 |
|
struct cmdline_parser_params *params, const char *additional_error) |
| 594 |
|
{ |
| 595 |
|
int c; /* Character of the parsed option. */ |
| 645 |
|
{ "forces", 0, NULL, 'f' }, |
| 646 |
|
{ "vectors", 0, NULL, 'u' }, |
| 647 |
|
{ "charges", 0, NULL, 'c' }, |
| 648 |
< |
{ NULL, 0, NULL, 0 } |
| 648 |
> |
{ 0, 0, 0, 0 } |
| 649 |
|
}; |
| 650 |
|
|
| 651 |
|
c = getopt_long (argc, argv, "hVi:o:n:wmzrts:bvfuc", long_options, &option_index); |