| 33 |
|
{ |
| 34 |
|
cmdline_parser_print_version (); |
| 35 |
|
printf("\n" |
| 36 |
< |
"Usage: %s [OPTIONS]... [FILES]...\n", CMDLINE_PARSER_PACKAGE); |
| 36 |
> |
"Usage: %s [OPTIONS]... [FILES]...\n", CMDLINE_PARSER_PACKAGE); |
| 37 |
|
printf("\n"); |
| 38 |
|
printf(" -h, --help Print help and exit\n"); |
| 39 |
|
printf(" -V, --version Print version and exit\n"); |
| 74 |
|
args_info->nx_given = 0 ; |
| 75 |
|
args_info->ny_given = 0 ; |
| 76 |
|
args_info->nz_given = 0 ; |
| 77 |
< |
#define clear_args() { \ |
| 78 |
< |
args_info->output_arg = NULL; \ |
| 79 |
< |
args_info->latticetype_arg = gengetopt_strdup("fcc") ;\ |
| 80 |
< |
} |
| 77 |
> |
#define clear_args() { \ |
| 78 |
> |
args_info->output_arg = NULL; \ |
| 79 |
> |
args_info->latticetype_arg = gengetopt_strdup("fcc") ; \ |
| 80 |
> |
} |
| 81 |
|
|
| 82 |
|
clear_args(); |
| 83 |
|
|
| 138 |
|
case 0: /* Long option with no short option */ |
| 139 |
|
/* Lattice type string. Valid types are fcc,hcp,bcc and hcp-water.. */ |
| 140 |
|
if (strcmp (long_options[option_index].name, "latticetype") == 0) |
| 141 |
< |
{ |
| 142 |
< |
if (args_info->latticetype_given) |
| 143 |
< |
{ |
| 144 |
< |
fprintf (stderr, "%s: `--latticetype' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 145 |
< |
clear_args (); |
| 146 |
< |
exit (EXIT_FAILURE); |
| 147 |
< |
} |
| 148 |
< |
args_info->latticetype_given = 1; |
| 149 |
< |
if (args_info->latticetype_arg) |
| 150 |
< |
free (args_info->latticetype_arg); /* free default string */ |
| 151 |
< |
args_info->latticetype_arg = gengetopt_strdup (optarg); |
| 152 |
< |
break; |
| 153 |
< |
} |
| 141 |
> |
{ |
| 142 |
> |
if (args_info->latticetype_given) |
| 143 |
> |
{ |
| 144 |
> |
fprintf (stderr, "%s: `--latticetype' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 145 |
> |
clear_args (); |
| 146 |
> |
exit (EXIT_FAILURE); |
| 147 |
> |
} |
| 148 |
> |
args_info->latticetype_given = 1; |
| 149 |
> |
if (args_info->latticetype_arg) |
| 150 |
> |
free (args_info->latticetype_arg); /* free default string */ |
| 151 |
> |
args_info->latticetype_arg = gengetopt_strdup (optarg); |
| 152 |
> |
break; |
| 153 |
> |
} |
| 154 |
|
|
| 155 |
|
/* density (g/cm^3). */ |
| 156 |
|
else if (strcmp (long_options[option_index].name, "density") == 0) |
| 157 |
< |
{ |
| 158 |
< |
if (args_info->density_given) |
| 159 |
< |
{ |
| 160 |
< |
fprintf (stderr, "%s: `--density' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 161 |
< |
clear_args (); |
| 162 |
< |
exit (EXIT_FAILURE); |
| 163 |
< |
} |
| 164 |
< |
args_info->density_given = 1; |
| 165 |
< |
args_info->density_arg = strtod (optarg, NULL); |
| 166 |
< |
break; |
| 167 |
< |
} |
| 157 |
> |
{ |
| 158 |
> |
if (args_info->density_given) |
| 159 |
> |
{ |
| 160 |
> |
fprintf (stderr, "%s: `--density' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 161 |
> |
clear_args (); |
| 162 |
> |
exit (EXIT_FAILURE); |
| 163 |
> |
} |
| 164 |
> |
args_info->density_given = 1; |
| 165 |
> |
args_info->density_arg = strtod (optarg, NULL); |
| 166 |
> |
break; |
| 167 |
> |
} |
| 168 |
|
|
| 169 |
|
/* number of unit cells in x. */ |
| 170 |
|
else if (strcmp (long_options[option_index].name, "nx") == 0) |
| 171 |
< |
{ |
| 172 |
< |
if (args_info->nx_given) |
| 173 |
< |
{ |
| 174 |
< |
fprintf (stderr, "%s: `--nx' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 175 |
< |
clear_args (); |
| 176 |
< |
exit (EXIT_FAILURE); |
| 177 |
< |
} |
| 178 |
< |
args_info->nx_given = 1; |
| 179 |
< |
args_info->nx_arg = strtol (optarg,&stop_char,0); |
| 180 |
< |
break; |
| 181 |
< |
} |
| 171 |
> |
{ |
| 172 |
> |
if (args_info->nx_given) |
| 173 |
> |
{ |
| 174 |
> |
fprintf (stderr, "%s: `--nx' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 175 |
> |
clear_args (); |
| 176 |
> |
exit (EXIT_FAILURE); |
| 177 |
> |
} |
| 178 |
> |
args_info->nx_given = 1; |
| 179 |
> |
args_info->nx_arg = strtol (optarg,&stop_char,0); |
| 180 |
> |
break; |
| 181 |
> |
} |
| 182 |
|
|
| 183 |
|
/* number of unit cells in y. */ |
| 184 |
|
else if (strcmp (long_options[option_index].name, "ny") == 0) |
| 185 |
< |
{ |
| 186 |
< |
if (args_info->ny_given) |
| 187 |
< |
{ |
| 188 |
< |
fprintf (stderr, "%s: `--ny' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 189 |
< |
clear_args (); |
| 190 |
< |
exit (EXIT_FAILURE); |
| 191 |
< |
} |
| 192 |
< |
args_info->ny_given = 1; |
| 193 |
< |
args_info->ny_arg = strtol (optarg,&stop_char,0); |
| 194 |
< |
break; |
| 195 |
< |
} |
| 185 |
> |
{ |
| 186 |
> |
if (args_info->ny_given) |
| 187 |
> |
{ |
| 188 |
> |
fprintf (stderr, "%s: `--ny' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 189 |
> |
clear_args (); |
| 190 |
> |
exit (EXIT_FAILURE); |
| 191 |
> |
} |
| 192 |
> |
args_info->ny_given = 1; |
| 193 |
> |
args_info->ny_arg = strtol (optarg,&stop_char,0); |
| 194 |
> |
break; |
| 195 |
> |
} |
| 196 |
|
|
| 197 |
|
/* number of unit cells in z. */ |
| 198 |
|
else if (strcmp (long_options[option_index].name, "nz") == 0) |
| 199 |
< |
{ |
| 200 |
< |
if (args_info->nz_given) |
| 201 |
< |
{ |
| 202 |
< |
fprintf (stderr, "%s: `--nz' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 203 |
< |
clear_args (); |
| 204 |
< |
exit (EXIT_FAILURE); |
| 205 |
< |
} |
| 206 |
< |
args_info->nz_given = 1; |
| 207 |
< |
args_info->nz_arg = strtol (optarg,&stop_char,0); |
| 208 |
< |
break; |
| 209 |
< |
} |
| 199 |
> |
{ |
| 200 |
> |
if (args_info->nz_given) |
| 201 |
> |
{ |
| 202 |
> |
fprintf (stderr, "%s: `--nz' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
| 203 |
> |
clear_args (); |
| 204 |
> |
exit (EXIT_FAILURE); |
| 205 |
> |
} |
| 206 |
> |
args_info->nz_given = 1; |
| 207 |
> |
args_info->nz_arg = strtol (optarg,&stop_char,0); |
| 208 |
> |
break; |
| 209 |
> |
} |
| 210 |
|
|
| 211 |
|
|
| 212 |
|
case '?': /* Invalid option. */ |