| 1 |
|
/* |
| 2 |
< |
File autogenerated by gengetopt version 2.15 |
| 2 |
> |
File autogenerated by gengetopt version 2.16 |
| 3 |
|
generated with the following command: |
| 4 |
< |
gengetopt --file-name=randomBuilderCmd --unamed-opts |
| 4 |
> |
gengetopt -F randomBuilderCmd --unamed-opts |
| 5 |
|
|
| 6 |
|
The developers of gengetopt consider the fixed text that goes in all |
| 7 |
|
gengetopt output files to be in the public domain: |
| 48 |
|
args_info->help_given = 0 ; |
| 49 |
|
args_info->version_given = 0 ; |
| 50 |
|
args_info->output_given = 0 ; |
| 51 |
– |
args_info->latticetype_given = 0 ; |
| 51 |
|
args_info->density_given = 0 ; |
| 52 |
|
args_info->nx_given = 0 ; |
| 53 |
|
args_info->ny_given = 0 ; |
| 60 |
|
{ |
| 61 |
|
args_info->output_arg = NULL; |
| 62 |
|
args_info->output_orig = NULL; |
| 64 |
– |
args_info->latticetype_arg = gengetopt_strdup ("fcc"); |
| 65 |
– |
args_info->latticetype_orig = NULL; |
| 63 |
|
args_info->density_orig = NULL; |
| 64 |
|
args_info->nx_orig = NULL; |
| 65 |
|
args_info->ny_orig = NULL; |
| 79 |
|
cmdline_parser_print_help (void) |
| 80 |
|
{ |
| 81 |
|
cmdline_parser_print_version (); |
| 82 |
< |
printf("\nUsage: simpleBuilder [OPTIONS]... [FILES]...\n\n"); |
| 82 |
> |
printf("\nUsage: randomBuilder [OPTIONS]... [FILES]...\n\n"); |
| 83 |
|
printf("%s\n"," -h, --help Print help and exit"); |
| 84 |
|
printf("%s\n"," -V, --version Print version and exit"); |
| 85 |
|
printf("%s\n"," -o, --output=STRING Output file name"); |
| 89 |
– |
printf("%s\n"," --latticetype=STRING Lattice type string. Valid types are fcc,hcp,bcc \n and hcp-water. (default=`fcc')"); |
| 86 |
|
printf("%s\n"," --density=DOUBLE density (g/cm^3)"); |
| 87 |
|
printf("%s\n"," --nx=INT number of unit cells in x"); |
| 88 |
|
printf("%s\n"," --ny=INT number of unit cells in y"); |
| 116 |
|
free (args_info->output_orig); /* free previous argument */ |
| 117 |
|
args_info->output_orig = 0; |
| 118 |
|
} |
| 123 |
– |
if (args_info->latticetype_arg) |
| 124 |
– |
{ |
| 125 |
– |
free (args_info->latticetype_arg); /* free previous argument */ |
| 126 |
– |
args_info->latticetype_arg = 0; |
| 127 |
– |
} |
| 128 |
– |
if (args_info->latticetype_orig) |
| 129 |
– |
{ |
| 130 |
– |
free (args_info->latticetype_orig); /* free previous argument */ |
| 131 |
– |
args_info->latticetype_orig = 0; |
| 132 |
– |
} |
| 119 |
|
if (args_info->density_orig) |
| 120 |
|
{ |
| 121 |
|
free (args_info->density_orig); /* free previous argument */ |
| 188 |
|
fprintf(outfile, "%s\n", "output"); |
| 189 |
|
} |
| 190 |
|
} |
| 205 |
– |
if (args_info->latticetype_given) { |
| 206 |
– |
if (args_info->latticetype_orig) { |
| 207 |
– |
fprintf(outfile, "%s=\"%s\"\n", "latticetype", args_info->latticetype_orig); |
| 208 |
– |
} else { |
| 209 |
– |
fprintf(outfile, "%s\n", "latticetype"); |
| 210 |
– |
} |
| 211 |
– |
} |
| 191 |
|
if (args_info->density_given) { |
| 192 |
|
if (args_info->density_orig) { |
| 193 |
|
fprintf(outfile, "%s=\"%s\"\n", "density", args_info->density_orig); |
| 339 |
|
{ |
| 340 |
|
int error = 0; |
| 341 |
|
|
| 342 |
+ |
if (! args_info->output_given) |
| 343 |
+ |
{ |
| 344 |
+ |
fprintf (stderr, "%s: '--output' ('-o') option required%s\n", prog_name, (additional_error ? additional_error : "")); |
| 345 |
+ |
error = 1; |
| 346 |
+ |
} |
| 347 |
|
if (! args_info->density_given) |
| 348 |
|
{ |
| 349 |
|
fprintf (stderr, "%s: '--density' option required%s\n", prog_name, (additional_error ? additional_error : "")); |
| 386 |
|
cmdline_parser_init (&local_args_info); |
| 387 |
|
|
| 388 |
|
optarg = 0; |
| 389 |
< |
optind = 1; |
| 389 |
> |
optind = 0; |
| 390 |
|
opterr = 1; |
| 391 |
|
optopt = '?'; |
| 392 |
|
|
| 399 |
|
{ "help", 0, NULL, 'h' }, |
| 400 |
|
{ "version", 0, NULL, 'V' }, |
| 401 |
|
{ "output", 1, NULL, 'o' }, |
| 418 |
– |
{ "latticetype", 1, NULL, 0 }, |
| 402 |
|
{ "density", 1, NULL, 0 }, |
| 403 |
|
{ "nx", 1, NULL, 0 }, |
| 404 |
|
{ "ny", 1, NULL, 0 }, |
| 444 |
|
|
| 445 |
|
|
| 446 |
|
case 0: /* Long option with no short option */ |
| 447 |
< |
/* Lattice type string. Valid types are fcc,hcp,bcc and hcp-water.. */ |
| 448 |
< |
if (strcmp (long_options[option_index].name, "latticetype") == 0) |
| 466 |
< |
{ |
| 467 |
< |
if (local_args_info.latticetype_given) |
| 468 |
< |
{ |
| 469 |
< |
fprintf (stderr, "%s: `--latticetype' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 470 |
< |
goto failure; |
| 471 |
< |
} |
| 472 |
< |
if (args_info->latticetype_given && ! override) |
| 473 |
< |
continue; |
| 474 |
< |
local_args_info.latticetype_given = 1; |
| 475 |
< |
args_info->latticetype_given = 1; |
| 476 |
< |
if (args_info->latticetype_arg) |
| 477 |
< |
free (args_info->latticetype_arg); /* free previous string */ |
| 478 |
< |
args_info->latticetype_arg = gengetopt_strdup (optarg); |
| 479 |
< |
if (args_info->latticetype_orig) |
| 480 |
< |
free (args_info->latticetype_orig); /* free previous string */ |
| 481 |
< |
args_info->latticetype_orig = gengetopt_strdup (optarg); |
| 482 |
< |
} |
| 483 |
< |
/* density (g/cm^3). */ |
| 484 |
< |
else if (strcmp (long_options[option_index].name, "density") == 0) |
| 447 |
> |
/* density (g/cm^3). */ |
| 448 |
> |
if (strcmp (long_options[option_index].name, "density") == 0) |
| 449 |
|
{ |
| 450 |
|
if (local_args_info.density_given) |
| 451 |
|
{ |