| 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; |
| 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"); |
| 115 |
|
{ |
| 116 |
|
free (args_info->output_orig); /* free previous argument */ |
| 117 |
|
args_info->output_orig = 0; |
| 122 |
– |
} |
| 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; |
| 118 |
|
} |
| 119 |
|
if (args_info->density_orig) |
| 120 |
|
{ |
| 186 |
|
fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); |
| 187 |
|
} else { |
| 188 |
|
fprintf(outfile, "%s\n", "output"); |
| 203 |
– |
} |
| 204 |
– |
} |
| 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"); |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
if (args_info->density_given) { |
| 399 |
|
{ "help", 0, NULL, 'h' }, |
| 400 |
|
{ "version", 0, NULL, 'V' }, |
| 401 |
|
{ "output", 1, NULL, 'o' }, |
| 423 |
– |
{ "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 */ |
| 469 |
– |
/* Lattice type string. Valid types are fcc,hcp,bcc and hcp-water.. */ |
| 470 |
– |
if (strcmp (long_options[option_index].name, "latticetype") == 0) |
| 471 |
– |
{ |
| 472 |
– |
if (local_args_info.latticetype_given) |
| 473 |
– |
{ |
| 474 |
– |
fprintf (stderr, "%s: `--latticetype' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
| 475 |
– |
goto failure; |
| 476 |
– |
} |
| 477 |
– |
if (args_info->latticetype_given && ! override) |
| 478 |
– |
continue; |
| 479 |
– |
local_args_info.latticetype_given = 1; |
| 480 |
– |
args_info->latticetype_given = 1; |
| 481 |
– |
if (args_info->latticetype_arg) |
| 482 |
– |
free (args_info->latticetype_arg); /* free previous string */ |
| 483 |
– |
args_info->latticetype_arg = gengetopt_strdup (optarg); |
| 484 |
– |
if (args_info->latticetype_orig) |
| 485 |
– |
free (args_info->latticetype_orig); /* free previous string */ |
| 486 |
– |
args_info->latticetype_orig = gengetopt_strdup (optarg); |
| 487 |
– |
} |
| 447 |
|
/* density (g/cm^3). */ |
| 448 |
< |
else if (strcmp (long_options[option_index].name, "density") == 0) |
| 448 |
> |
if (strcmp (long_options[option_index].name, "density") == 0) |
| 449 |
|
{ |
| 450 |
|
if (local_args_info.density_given) |
| 451 |
|
{ |