| 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 StaticPropsCmd |
| 4 |
> |
gengetopt --file-name=StaticPropsCmd --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: |
| 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 "StaticPropsCmd.h" |
| 31 |
|
|
| 32 |
|
const char *gengetopt_args_info_purpose = ""; |
| 33 |
|
|
| 34 |
< |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]..."; |
| 34 |
> |
const char *gengetopt_args_info_usage = "Usage: StaticProps [OPTIONS]... [FILES]..."; |
| 35 |
|
|
| 36 |
|
const char *gengetopt_args_info_description = ""; |
| 37 |
|
|
| 47 |
|
" --nbins_z=INT number of bins in z axis (default=`100')", |
| 48 |
|
" -a, --nanglebins=INT number of bins for cos(angle) (default=`50')", |
| 49 |
|
" -c, --rcut=DOUBLE cutoff radius (rcut)", |
| 50 |
+ |
" --dz=DOUBLE slab width (dz)", |
| 51 |
|
" --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
| 52 |
|
" --zlength=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)", |
| 53 |
|
" -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')", |
| 56 |
|
" --sele3=selection script select the third stuntdouble set", |
| 57 |
|
" --refsele=selection script\n select reference (use and only use with --gxyz)", |
| 58 |
|
" --comsele=selection script\n select stunt doubles for center-of-mass \n reference point", |
| 59 |
+ |
" --seleoffset=INT global index offset for a second object (used \n to define a vector between sites in molecule)", |
| 60 |
|
" --molname=STRING molecule name", |
| 61 |
|
" --begin=INT begin internal index", |
| 62 |
|
" --end=INT end internal index", |
| 65 |
|
" --bo bond order parameter (--rcut must be specified)", |
| 66 |
|
" --bor bond order parameter as a function of radius \n (--rcut must be specified)", |
| 67 |
|
" --bad N(theta) bond angle density within (--rcut must \n be specified)", |
| 68 |
+ |
" --count count of molecules matching selection criteria \n (and associated statistics)", |
| 69 |
|
" -g, --gofr g(r)", |
| 70 |
|
" --gofz g(z)", |
| 71 |
|
" --r_theta g(r, cos(theta))", |
| 73 |
|
" --r_z g(r, z)", |
| 74 |
|
" --theta_omega g(cos(theta), cos(omega))", |
| 75 |
|
" --gxyz g(x, y, z)", |
| 76 |
< |
" -p, --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)", |
| 76 |
> |
" --twodgofr 2D g(r) (Slab width --dz must be specified)", |
| 77 |
> |
" -p, --p2 p2 order parameter (--sele1 must be specified, \n --sele2 is optional)", |
| 78 |
|
" --rp2 rp2 order parameter (--sele1 and --sele2 must \n be specified)", |
| 79 |
|
" -s, --scd scd order parameter (either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)", |
| 80 |
|
" -d, --density density plot", |
| 81 |
|
" --slab_density slab density", |
| 82 |
< |
" --p_angle p(cos(theta))", |
| 82 |
> |
" --p_angle p(cos(theta)) (--sele1 must be specified, \n --sele2 is optional)", |
| 83 |
|
" --hxy hxy", |
| 84 |
|
" --rho_r rho of R", |
| 85 |
+ |
" --angle_r angle of R", |
| 86 |
|
" --hullvol hull volume of nanoparticle", |
| 87 |
+ |
" --rodlength length of nanorod", |
| 88 |
+ |
" -Q, --tet_param tetrahedrality order parameter (Qk)", |
| 89 |
+ |
" --tet_param_z spatially-resolved tetrahedrality order \n parameter Qk(z)", |
| 90 |
+ |
" --rnemdz slab-resolved RNEMD statistics (temperature, \n density, velocity)", |
| 91 |
+ |
" --rnemdr shell-resolved RNEMD statistics (temperature, \n density, angular velocity)", |
| 92 |
+ |
" --rnemdrt shell and angle-resolved RNEMD statistics \n (temperature, density, angular velocity)", |
| 93 |
|
0 |
| 94 |
|
}; |
| 95 |
|
|
| 105 |
|
void clear_args (struct gengetopt_args_info *args_info); |
| 106 |
|
|
| 107 |
|
static int |
| 108 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 108 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
| 109 |
|
struct cmdline_parser_params *params, const char *additional_error); |
| 110 |
|
|
| 111 |
|
static int |
| 128 |
|
args_info->nbins_z_given = 0 ; |
| 129 |
|
args_info->nanglebins_given = 0 ; |
| 130 |
|
args_info->rcut_given = 0 ; |
| 131 |
+ |
args_info->dz_given = 0 ; |
| 132 |
|
args_info->length_given = 0 ; |
| 133 |
|
args_info->zlength_given = 0 ; |
| 134 |
|
args_info->zoffset_given = 0 ; |
| 137 |
|
args_info->sele3_given = 0 ; |
| 138 |
|
args_info->refsele_given = 0 ; |
| 139 |
|
args_info->comsele_given = 0 ; |
| 140 |
+ |
args_info->seleoffset_given = 0 ; |
| 141 |
|
args_info->molname_given = 0 ; |
| 142 |
|
args_info->begin_given = 0 ; |
| 143 |
|
args_info->end_given = 0 ; |
| 145 |
|
args_info->bo_given = 0 ; |
| 146 |
|
args_info->bor_given = 0 ; |
| 147 |
|
args_info->bad_given = 0 ; |
| 148 |
+ |
args_info->count_given = 0 ; |
| 149 |
|
args_info->gofr_given = 0 ; |
| 150 |
|
args_info->gofz_given = 0 ; |
| 151 |
|
args_info->r_theta_given = 0 ; |
| 153 |
|
args_info->r_z_given = 0 ; |
| 154 |
|
args_info->theta_omega_given = 0 ; |
| 155 |
|
args_info->gxyz_given = 0 ; |
| 156 |
+ |
args_info->twodgofr_given = 0 ; |
| 157 |
|
args_info->p2_given = 0 ; |
| 158 |
|
args_info->rp2_given = 0 ; |
| 159 |
|
args_info->scd_given = 0 ; |
| 162 |
|
args_info->p_angle_given = 0 ; |
| 163 |
|
args_info->hxy_given = 0 ; |
| 164 |
|
args_info->rho_r_given = 0 ; |
| 165 |
+ |
args_info->angle_r_given = 0 ; |
| 166 |
|
args_info->hullvol_given = 0 ; |
| 167 |
+ |
args_info->rodlength_given = 0 ; |
| 168 |
+ |
args_info->tet_param_given = 0 ; |
| 169 |
+ |
args_info->tet_param_z_given = 0 ; |
| 170 |
+ |
args_info->rnemdz_given = 0 ; |
| 171 |
+ |
args_info->rnemdr_given = 0 ; |
| 172 |
+ |
args_info->rnemdrt_given = 0 ; |
| 173 |
|
args_info->staticProps_group_counter = 0 ; |
| 174 |
|
} |
| 175 |
|
|
| 176 |
|
static |
| 177 |
|
void clear_args (struct gengetopt_args_info *args_info) |
| 178 |
|
{ |
| 179 |
+ |
FIX_UNUSED (args_info); |
| 180 |
|
args_info->input_arg = NULL; |
| 181 |
|
args_info->input_orig = NULL; |
| 182 |
|
args_info->output_arg = NULL; |
| 194 |
|
args_info->nanglebins_arg = 50; |
| 195 |
|
args_info->nanglebins_orig = NULL; |
| 196 |
|
args_info->rcut_orig = NULL; |
| 197 |
+ |
args_info->dz_orig = NULL; |
| 198 |
|
args_info->length_orig = NULL; |
| 199 |
|
args_info->zlength_orig = NULL; |
| 200 |
|
args_info->zoffset_arg = 0; |
| 209 |
|
args_info->refsele_orig = NULL; |
| 210 |
|
args_info->comsele_arg = NULL; |
| 211 |
|
args_info->comsele_orig = NULL; |
| 212 |
+ |
args_info->seleoffset_orig = NULL; |
| 213 |
|
args_info->molname_arg = NULL; |
| 214 |
|
args_info->molname_orig = NULL; |
| 215 |
|
args_info->begin_orig = NULL; |
| 234 |
|
args_info->nbins_z_help = gengetopt_args_info_help[8] ; |
| 235 |
|
args_info->nanglebins_help = gengetopt_args_info_help[9] ; |
| 236 |
|
args_info->rcut_help = gengetopt_args_info_help[10] ; |
| 237 |
< |
args_info->length_help = gengetopt_args_info_help[11] ; |
| 238 |
< |
args_info->zlength_help = gengetopt_args_info_help[12] ; |
| 239 |
< |
args_info->zoffset_help = gengetopt_args_info_help[13] ; |
| 240 |
< |
args_info->sele1_help = gengetopt_args_info_help[14] ; |
| 241 |
< |
args_info->sele2_help = gengetopt_args_info_help[15] ; |
| 242 |
< |
args_info->sele3_help = gengetopt_args_info_help[16] ; |
| 243 |
< |
args_info->refsele_help = gengetopt_args_info_help[17] ; |
| 244 |
< |
args_info->comsele_help = gengetopt_args_info_help[18] ; |
| 245 |
< |
args_info->molname_help = gengetopt_args_info_help[19] ; |
| 246 |
< |
args_info->begin_help = gengetopt_args_info_help[20] ; |
| 247 |
< |
args_info->end_help = gengetopt_args_info_help[21] ; |
| 248 |
< |
args_info->radius_help = gengetopt_args_info_help[22] ; |
| 249 |
< |
args_info->bo_help = gengetopt_args_info_help[24] ; |
| 250 |
< |
args_info->bor_help = gengetopt_args_info_help[25] ; |
| 251 |
< |
args_info->bad_help = gengetopt_args_info_help[26] ; |
| 252 |
< |
args_info->gofr_help = gengetopt_args_info_help[27] ; |
| 253 |
< |
args_info->gofz_help = gengetopt_args_info_help[28] ; |
| 254 |
< |
args_info->r_theta_help = gengetopt_args_info_help[29] ; |
| 255 |
< |
args_info->r_omega_help = gengetopt_args_info_help[30] ; |
| 256 |
< |
args_info->r_z_help = gengetopt_args_info_help[31] ; |
| 257 |
< |
args_info->theta_omega_help = gengetopt_args_info_help[32] ; |
| 258 |
< |
args_info->gxyz_help = gengetopt_args_info_help[33] ; |
| 259 |
< |
args_info->p2_help = gengetopt_args_info_help[34] ; |
| 260 |
< |
args_info->rp2_help = gengetopt_args_info_help[35] ; |
| 261 |
< |
args_info->scd_help = gengetopt_args_info_help[36] ; |
| 262 |
< |
args_info->density_help = gengetopt_args_info_help[37] ; |
| 263 |
< |
args_info->slab_density_help = gengetopt_args_info_help[38] ; |
| 264 |
< |
args_info->p_angle_help = gengetopt_args_info_help[39] ; |
| 265 |
< |
args_info->hxy_help = gengetopt_args_info_help[40] ; |
| 266 |
< |
args_info->rho_r_help = gengetopt_args_info_help[41] ; |
| 267 |
< |
args_info->hullvol_help = gengetopt_args_info_help[42] ; |
| 237 |
> |
args_info->dz_help = gengetopt_args_info_help[11] ; |
| 238 |
> |
args_info->length_help = gengetopt_args_info_help[12] ; |
| 239 |
> |
args_info->zlength_help = gengetopt_args_info_help[13] ; |
| 240 |
> |
args_info->zoffset_help = gengetopt_args_info_help[14] ; |
| 241 |
> |
args_info->sele1_help = gengetopt_args_info_help[15] ; |
| 242 |
> |
args_info->sele2_help = gengetopt_args_info_help[16] ; |
| 243 |
> |
args_info->sele3_help = gengetopt_args_info_help[17] ; |
| 244 |
> |
args_info->refsele_help = gengetopt_args_info_help[18] ; |
| 245 |
> |
args_info->comsele_help = gengetopt_args_info_help[19] ; |
| 246 |
> |
args_info->seleoffset_help = gengetopt_args_info_help[20] ; |
| 247 |
> |
args_info->molname_help = gengetopt_args_info_help[21] ; |
| 248 |
> |
args_info->begin_help = gengetopt_args_info_help[22] ; |
| 249 |
> |
args_info->end_help = gengetopt_args_info_help[23] ; |
| 250 |
> |
args_info->radius_help = gengetopt_args_info_help[24] ; |
| 251 |
> |
args_info->bo_help = gengetopt_args_info_help[26] ; |
| 252 |
> |
args_info->bor_help = gengetopt_args_info_help[27] ; |
| 253 |
> |
args_info->bad_help = gengetopt_args_info_help[28] ; |
| 254 |
> |
args_info->count_help = gengetopt_args_info_help[29] ; |
| 255 |
> |
args_info->gofr_help = gengetopt_args_info_help[30] ; |
| 256 |
> |
args_info->gofz_help = gengetopt_args_info_help[31] ; |
| 257 |
> |
args_info->r_theta_help = gengetopt_args_info_help[32] ; |
| 258 |
> |
args_info->r_omega_help = gengetopt_args_info_help[33] ; |
| 259 |
> |
args_info->r_z_help = gengetopt_args_info_help[34] ; |
| 260 |
> |
args_info->theta_omega_help = gengetopt_args_info_help[35] ; |
| 261 |
> |
args_info->gxyz_help = gengetopt_args_info_help[36] ; |
| 262 |
> |
args_info->twodgofr_help = gengetopt_args_info_help[37] ; |
| 263 |
> |
args_info->p2_help = gengetopt_args_info_help[38] ; |
| 264 |
> |
args_info->rp2_help = gengetopt_args_info_help[39] ; |
| 265 |
> |
args_info->scd_help = gengetopt_args_info_help[40] ; |
| 266 |
> |
args_info->density_help = gengetopt_args_info_help[41] ; |
| 267 |
> |
args_info->slab_density_help = gengetopt_args_info_help[42] ; |
| 268 |
> |
args_info->p_angle_help = gengetopt_args_info_help[43] ; |
| 269 |
> |
args_info->hxy_help = gengetopt_args_info_help[44] ; |
| 270 |
> |
args_info->rho_r_help = gengetopt_args_info_help[45] ; |
| 271 |
> |
args_info->angle_r_help = gengetopt_args_info_help[46] ; |
| 272 |
> |
args_info->hullvol_help = gengetopt_args_info_help[47] ; |
| 273 |
> |
args_info->rodlength_help = gengetopt_args_info_help[48] ; |
| 274 |
> |
args_info->tet_param_help = gengetopt_args_info_help[49] ; |
| 275 |
> |
args_info->tet_param_z_help = gengetopt_args_info_help[50] ; |
| 276 |
> |
args_info->rnemdz_help = gengetopt_args_info_help[51] ; |
| 277 |
> |
args_info->rnemdr_help = gengetopt_args_info_help[52] ; |
| 278 |
> |
args_info->rnemdrt_help = gengetopt_args_info_help[53] ; |
| 279 |
|
|
| 280 |
|
} |
| 281 |
|
|
| 282 |
|
void |
| 283 |
|
cmdline_parser_print_version (void) |
| 284 |
|
{ |
| 285 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
| 285 |
> |
printf ("%s %s\n", |
| 286 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
| 287 |
> |
CMDLINE_PARSER_VERSION); |
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
static void print_help_common(void) { |
| 299 |
|
printf("\n"); |
| 300 |
|
|
| 301 |
|
if (strlen(gengetopt_args_info_description) > 0) |
| 302 |
< |
printf("%s\n", gengetopt_args_info_description); |
| 302 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
| 303 |
|
} |
| 304 |
|
|
| 305 |
|
void |
| 317 |
|
clear_given (args_info); |
| 318 |
|
clear_args (args_info); |
| 319 |
|
init_args_info (args_info); |
| 320 |
+ |
|
| 321 |
+ |
args_info->inputs = 0; |
| 322 |
+ |
args_info->inputs_num = 0; |
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
void |
| 358 |
|
static void |
| 359 |
|
cmdline_parser_release (struct gengetopt_args_info *args_info) |
| 360 |
|
{ |
| 361 |
< |
|
| 361 |
> |
unsigned int i; |
| 362 |
|
free_string_field (&(args_info->input_arg)); |
| 363 |
|
free_string_field (&(args_info->input_orig)); |
| 364 |
|
free_string_field (&(args_info->output_arg)); |
| 370 |
|
free_string_field (&(args_info->nbins_z_orig)); |
| 371 |
|
free_string_field (&(args_info->nanglebins_orig)); |
| 372 |
|
free_string_field (&(args_info->rcut_orig)); |
| 373 |
+ |
free_string_field (&(args_info->dz_orig)); |
| 374 |
|
free_string_field (&(args_info->length_orig)); |
| 375 |
|
free_string_field (&(args_info->zlength_orig)); |
| 376 |
|
free_string_field (&(args_info->zoffset_orig)); |
| 384 |
|
free_string_field (&(args_info->refsele_orig)); |
| 385 |
|
free_string_field (&(args_info->comsele_arg)); |
| 386 |
|
free_string_field (&(args_info->comsele_orig)); |
| 387 |
+ |
free_string_field (&(args_info->seleoffset_orig)); |
| 388 |
|
free_string_field (&(args_info->molname_arg)); |
| 389 |
|
free_string_field (&(args_info->molname_orig)); |
| 390 |
|
free_string_field (&(args_info->begin_orig)); |
| 392 |
|
free_string_field (&(args_info->radius_orig)); |
| 393 |
|
|
| 394 |
|
|
| 395 |
+ |
for (i = 0; i < args_info->inputs_num; ++i) |
| 396 |
+ |
free (args_info->inputs [i]); |
| 397 |
|
|
| 398 |
+ |
if (args_info->inputs_num) |
| 399 |
+ |
free (args_info->inputs); |
| 400 |
+ |
|
| 401 |
|
clear_given (args_info); |
| 402 |
|
} |
| 403 |
|
|
| 404 |
|
|
| 405 |
|
static void |
| 406 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
| 406 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
| 407 |
|
{ |
| 408 |
+ |
FIX_UNUSED (values); |
| 409 |
|
if (arg) { |
| 410 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
| 411 |
|
} else { |
| 447 |
|
write_into_file(outfile, "nanglebins", args_info->nanglebins_orig, 0); |
| 448 |
|
if (args_info->rcut_given) |
| 449 |
|
write_into_file(outfile, "rcut", args_info->rcut_orig, 0); |
| 450 |
+ |
if (args_info->dz_given) |
| 451 |
+ |
write_into_file(outfile, "dz", args_info->dz_orig, 0); |
| 452 |
|
if (args_info->length_given) |
| 453 |
|
write_into_file(outfile, "length", args_info->length_orig, 0); |
| 454 |
|
if (args_info->zlength_given) |
| 465 |
|
write_into_file(outfile, "refsele", args_info->refsele_orig, 0); |
| 466 |
|
if (args_info->comsele_given) |
| 467 |
|
write_into_file(outfile, "comsele", args_info->comsele_orig, 0); |
| 468 |
+ |
if (args_info->seleoffset_given) |
| 469 |
+ |
write_into_file(outfile, "seleoffset", args_info->seleoffset_orig, 0); |
| 470 |
|
if (args_info->molname_given) |
| 471 |
|
write_into_file(outfile, "molname", args_info->molname_orig, 0); |
| 472 |
|
if (args_info->begin_given) |
| 481 |
|
write_into_file(outfile, "bor", 0, 0 ); |
| 482 |
|
if (args_info->bad_given) |
| 483 |
|
write_into_file(outfile, "bad", 0, 0 ); |
| 484 |
+ |
if (args_info->count_given) |
| 485 |
+ |
write_into_file(outfile, "count", 0, 0 ); |
| 486 |
|
if (args_info->gofr_given) |
| 487 |
|
write_into_file(outfile, "gofr", 0, 0 ); |
| 488 |
|
if (args_info->gofz_given) |
| 497 |
|
write_into_file(outfile, "theta_omega", 0, 0 ); |
| 498 |
|
if (args_info->gxyz_given) |
| 499 |
|
write_into_file(outfile, "gxyz", 0, 0 ); |
| 500 |
+ |
if (args_info->twodgofr_given) |
| 501 |
+ |
write_into_file(outfile, "twodgofr", 0, 0 ); |
| 502 |
|
if (args_info->p2_given) |
| 503 |
|
write_into_file(outfile, "p2", 0, 0 ); |
| 504 |
|
if (args_info->rp2_given) |
| 515 |
|
write_into_file(outfile, "hxy", 0, 0 ); |
| 516 |
|
if (args_info->rho_r_given) |
| 517 |
|
write_into_file(outfile, "rho_r", 0, 0 ); |
| 518 |
+ |
if (args_info->angle_r_given) |
| 519 |
+ |
write_into_file(outfile, "angle_r", 0, 0 ); |
| 520 |
|
if (args_info->hullvol_given) |
| 521 |
|
write_into_file(outfile, "hullvol", 0, 0 ); |
| 522 |
+ |
if (args_info->rodlength_given) |
| 523 |
+ |
write_into_file(outfile, "rodlength", 0, 0 ); |
| 524 |
+ |
if (args_info->tet_param_given) |
| 525 |
+ |
write_into_file(outfile, "tet_param", 0, 0 ); |
| 526 |
+ |
if (args_info->tet_param_z_given) |
| 527 |
+ |
write_into_file(outfile, "tet_param_z", 0, 0 ); |
| 528 |
+ |
if (args_info->rnemdz_given) |
| 529 |
+ |
write_into_file(outfile, "rnemdz", 0, 0 ); |
| 530 |
+ |
if (args_info->rnemdr_given) |
| 531 |
+ |
write_into_file(outfile, "rnemdr", 0, 0 ); |
| 532 |
+ |
if (args_info->rnemdrt_given) |
| 533 |
+ |
write_into_file(outfile, "rnemdrt", 0, 0 ); |
| 534 |
|
|
| 535 |
|
|
| 536 |
|
i = EXIT_SUCCESS; |
| 567 |
|
char * |
| 568 |
|
gengetopt_strdup (const char *s) |
| 569 |
|
{ |
| 570 |
< |
char *result = NULL; |
| 570 |
> |
char *result = 0; |
| 571 |
|
if (!s) |
| 572 |
|
return result; |
| 573 |
|
|
| 587 |
|
args_info->bo_given = 0 ; |
| 588 |
|
args_info->bor_given = 0 ; |
| 589 |
|
args_info->bad_given = 0 ; |
| 590 |
+ |
args_info->count_given = 0 ; |
| 591 |
|
args_info->gofr_given = 0 ; |
| 592 |
|
args_info->gofz_given = 0 ; |
| 593 |
|
args_info->r_theta_given = 0 ; |
| 595 |
|
args_info->r_z_given = 0 ; |
| 596 |
|
args_info->theta_omega_given = 0 ; |
| 597 |
|
args_info->gxyz_given = 0 ; |
| 598 |
+ |
args_info->twodgofr_given = 0 ; |
| 599 |
|
args_info->p2_given = 0 ; |
| 600 |
|
args_info->rp2_given = 0 ; |
| 601 |
|
args_info->scd_given = 0 ; |
| 604 |
|
args_info->p_angle_given = 0 ; |
| 605 |
|
args_info->hxy_given = 0 ; |
| 606 |
|
args_info->rho_r_given = 0 ; |
| 607 |
+ |
args_info->angle_r_given = 0 ; |
| 608 |
|
args_info->hullvol_given = 0 ; |
| 609 |
+ |
args_info->rodlength_given = 0 ; |
| 610 |
+ |
args_info->tet_param_given = 0 ; |
| 611 |
+ |
args_info->tet_param_z_given = 0 ; |
| 612 |
+ |
args_info->rnemdz_given = 0 ; |
| 613 |
+ |
args_info->rnemdr_given = 0 ; |
| 614 |
+ |
args_info->rnemdrt_given = 0 ; |
| 615 |
|
|
| 616 |
|
args_info->staticProps_group_counter = 0; |
| 617 |
|
} |
| 618 |
|
|
| 619 |
|
int |
| 620 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
| 620 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
| 621 |
|
{ |
| 622 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
| 623 |
|
} |
| 624 |
|
|
| 625 |
|
int |
| 626 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 626 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
| 627 |
|
struct cmdline_parser_params *params) |
| 628 |
|
{ |
| 629 |
|
int result; |
| 630 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
| 630 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
| 631 |
|
|
| 632 |
|
if (result == EXIT_FAILURE) |
| 633 |
|
{ |
| 639 |
|
} |
| 640 |
|
|
| 641 |
|
int |
| 642 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
| 642 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
| 643 |
|
{ |
| 644 |
|
int result; |
| 645 |
|
struct cmdline_parser_params params; |
| 650 |
|
params.check_ambiguity = 0; |
| 651 |
|
params.print_errors = 1; |
| 652 |
|
|
| 653 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
| 653 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
| 654 |
|
|
| 655 |
|
if (result == EXIT_FAILURE) |
| 656 |
|
{ |
| 666 |
|
{ |
| 667 |
|
int result = EXIT_SUCCESS; |
| 668 |
|
|
| 669 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
| 669 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
| 670 |
|
result = EXIT_FAILURE; |
| 671 |
|
|
| 672 |
|
if (result == EXIT_FAILURE) |
| 682 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
| 683 |
|
{ |
| 684 |
|
int error = 0; |
| 685 |
+ |
FIX_UNUSED (additional_error); |
| 686 |
|
|
| 687 |
|
/* checks for required options */ |
| 688 |
|
if (! args_info->input_given) |
| 693 |
|
|
| 694 |
|
if (args_info->staticProps_group_counter == 0) |
| 695 |
|
{ |
| 696 |
< |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
| 696 |
> |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
| 697 |
|
error = 1; |
| 698 |
|
} |
| 699 |
|
|
| 727 |
|
static |
| 728 |
|
int update_arg(void *field, char **orig_field, |
| 729 |
|
unsigned int *field_given, unsigned int *prev_given, |
| 730 |
< |
char *value, char *possible_values[], const char *default_value, |
| 730 |
> |
char *value, const char *possible_values[], |
| 731 |
> |
const char *default_value, |
| 732 |
|
cmdline_parser_arg_type arg_type, |
| 733 |
|
int check_ambiguity, int override, |
| 734 |
|
int no_free, int multiple_option, |
| 739 |
|
const char *val = value; |
| 740 |
|
int found; |
| 741 |
|
char **string_field; |
| 742 |
+ |
FIX_UNUSED (field); |
| 743 |
|
|
| 744 |
|
stop_char = 0; |
| 745 |
|
found = 0; |
| 757 |
|
return 1; /* failure */ |
| 758 |
|
} |
| 759 |
|
|
| 760 |
+ |
FIX_UNUSED (default_value); |
| 761 |
|
|
| 762 |
|
if (field_given && *field_given && ! override) |
| 763 |
|
return 0; |
| 821 |
|
|
| 822 |
|
|
| 823 |
|
int |
| 824 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
| 824 |
> |
cmdline_parser_internal ( |
| 825 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
| 826 |
|
struct cmdline_parser_params *params, const char *additional_error) |
| 827 |
|
{ |
| 828 |
|
int c; /* Character of the parsed option. */ |
| 868 |
|
{ "nbins_z", 1, NULL, 0 }, |
| 869 |
|
{ "nanglebins", 1, NULL, 'a' }, |
| 870 |
|
{ "rcut", 1, NULL, 'c' }, |
| 871 |
+ |
{ "dz", 1, NULL, 0 }, |
| 872 |
|
{ "length", 1, NULL, 0 }, |
| 873 |
|
{ "zlength", 1, NULL, 0 }, |
| 874 |
|
{ "zoffset", 1, NULL, 'z' }, |
| 877 |
|
{ "sele3", 1, NULL, 0 }, |
| 878 |
|
{ "refsele", 1, NULL, 0 }, |
| 879 |
|
{ "comsele", 1, NULL, 0 }, |
| 880 |
+ |
{ "seleoffset", 1, NULL, 0 }, |
| 881 |
|
{ "molname", 1, NULL, 0 }, |
| 882 |
|
{ "begin", 1, NULL, 0 }, |
| 883 |
|
{ "end", 1, NULL, 0 }, |
| 885 |
|
{ "bo", 0, NULL, 0 }, |
| 886 |
|
{ "bor", 0, NULL, 0 }, |
| 887 |
|
{ "bad", 0, NULL, 0 }, |
| 888 |
+ |
{ "count", 0, NULL, 0 }, |
| 889 |
|
{ "gofr", 0, NULL, 'g' }, |
| 890 |
|
{ "gofz", 0, NULL, 0 }, |
| 891 |
|
{ "r_theta", 0, NULL, 0 }, |
| 893 |
|
{ "r_z", 0, NULL, 0 }, |
| 894 |
|
{ "theta_omega", 0, NULL, 0 }, |
| 895 |
|
{ "gxyz", 0, NULL, 0 }, |
| 896 |
+ |
{ "twodgofr", 0, NULL, 0 }, |
| 897 |
|
{ "p2", 0, NULL, 'p' }, |
| 898 |
|
{ "rp2", 0, NULL, 0 }, |
| 899 |
|
{ "scd", 0, NULL, 's' }, |
| 902 |
|
{ "p_angle", 0, NULL, 0 }, |
| 903 |
|
{ "hxy", 0, NULL, 0 }, |
| 904 |
|
{ "rho_r", 0, NULL, 0 }, |
| 905 |
+ |
{ "angle_r", 0, NULL, 0 }, |
| 906 |
|
{ "hullvol", 0, NULL, 0 }, |
| 907 |
< |
{ NULL, 0, NULL, 0 } |
| 907 |
> |
{ "rodlength", 0, NULL, 0 }, |
| 908 |
> |
{ "tet_param", 0, NULL, 'Q' }, |
| 909 |
> |
{ "tet_param_z", 0, NULL, 0 }, |
| 910 |
> |
{ "rnemdz", 0, NULL, 0 }, |
| 911 |
> |
{ "rnemdr", 0, NULL, 0 }, |
| 912 |
> |
{ "rnemdrt", 0, NULL, 0 }, |
| 913 |
> |
{ 0, 0, 0, 0 } |
| 914 |
|
}; |
| 915 |
|
|
| 916 |
< |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsd", long_options, &option_index); |
| 916 |
> |
c = getopt_long (argc, argv, "hVi:o:n:b:x:y:a:c:z:gpsdQ", long_options, &option_index); |
| 917 |
|
|
| 918 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
| 919 |
|
|
| 1052 |
|
goto failure; |
| 1053 |
|
|
| 1054 |
|
break; |
| 1055 |
< |
case 'p': /* p2 order parameter (--sele1 and --sele2 must be specified). */ |
| 1055 |
> |
case 'p': /* p2 order parameter (--sele1 must be specified, --sele2 is optional). */ |
| 1056 |
|
|
| 1057 |
|
if (args_info->staticProps_group_counter && override) |
| 1058 |
|
reset_group_staticProps (args_info); |
| 1097 |
|
goto failure; |
| 1098 |
|
|
| 1099 |
|
break; |
| 1100 |
+ |
case 'Q': /* tetrahedrality order parameter (Qk). */ |
| 1101 |
+ |
|
| 1102 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1103 |
+ |
reset_group_staticProps (args_info); |
| 1104 |
+ |
args_info->staticProps_group_counter += 1; |
| 1105 |
+ |
|
| 1106 |
+ |
if (update_arg( 0 , |
| 1107 |
+ |
0 , &(args_info->tet_param_given), |
| 1108 |
+ |
&(local_args_info.tet_param_given), optarg, 0, 0, ARG_NO, |
| 1109 |
+ |
check_ambiguity, override, 0, 0, |
| 1110 |
+ |
"tet_param", 'Q', |
| 1111 |
+ |
additional_error)) |
| 1112 |
+ |
goto failure; |
| 1113 |
+ |
|
| 1114 |
+ |
break; |
| 1115 |
|
|
| 1116 |
|
case 0: /* Long option with no short option */ |
| 1117 |
|
/* number of bins in z axis. */ |
| 1124 |
|
&(local_args_info.nbins_z_given), optarg, 0, "100", ARG_INT, |
| 1125 |
|
check_ambiguity, override, 0, 0, |
| 1126 |
|
"nbins_z", '-', |
| 1127 |
+ |
additional_error)) |
| 1128 |
+ |
goto failure; |
| 1129 |
+ |
|
| 1130 |
+ |
} |
| 1131 |
+ |
/* slab width (dz). */ |
| 1132 |
+ |
else if (strcmp (long_options[option_index].name, "dz") == 0) |
| 1133 |
+ |
{ |
| 1134 |
+ |
|
| 1135 |
+ |
|
| 1136 |
+ |
if (update_arg( (void *)&(args_info->dz_arg), |
| 1137 |
+ |
&(args_info->dz_orig), &(args_info->dz_given), |
| 1138 |
+ |
&(local_args_info.dz_given), optarg, 0, 0, ARG_DOUBLE, |
| 1139 |
+ |
check_ambiguity, override, 0, 0, |
| 1140 |
+ |
"dz", '-', |
| 1141 |
|
additional_error)) |
| 1142 |
|
goto failure; |
| 1143 |
|
|
| 1240 |
|
goto failure; |
| 1241 |
|
|
| 1242 |
|
} |
| 1243 |
+ |
/* global index offset for a second object (used to define a vector between sites in molecule). */ |
| 1244 |
+ |
else if (strcmp (long_options[option_index].name, "seleoffset") == 0) |
| 1245 |
+ |
{ |
| 1246 |
+ |
|
| 1247 |
+ |
|
| 1248 |
+ |
if (update_arg( (void *)&(args_info->seleoffset_arg), |
| 1249 |
+ |
&(args_info->seleoffset_orig), &(args_info->seleoffset_given), |
| 1250 |
+ |
&(local_args_info.seleoffset_given), optarg, 0, 0, ARG_INT, |
| 1251 |
+ |
check_ambiguity, override, 0, 0, |
| 1252 |
+ |
"seleoffset", '-', |
| 1253 |
+ |
additional_error)) |
| 1254 |
+ |
goto failure; |
| 1255 |
+ |
|
| 1256 |
+ |
} |
| 1257 |
|
/* molecule name. */ |
| 1258 |
|
else if (strcmp (long_options[option_index].name, "molname") == 0) |
| 1259 |
|
{ |
| 1361 |
|
goto failure; |
| 1362 |
|
|
| 1363 |
|
} |
| 1364 |
+ |
/* count of molecules matching selection criteria (and associated statistics). */ |
| 1365 |
+ |
else if (strcmp (long_options[option_index].name, "count") == 0) |
| 1366 |
+ |
{ |
| 1367 |
+ |
|
| 1368 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1369 |
+ |
reset_group_staticProps (args_info); |
| 1370 |
+ |
args_info->staticProps_group_counter += 1; |
| 1371 |
+ |
|
| 1372 |
+ |
if (update_arg( 0 , |
| 1373 |
+ |
0 , &(args_info->count_given), |
| 1374 |
+ |
&(local_args_info.count_given), optarg, 0, 0, ARG_NO, |
| 1375 |
+ |
check_ambiguity, override, 0, 0, |
| 1376 |
+ |
"count", '-', |
| 1377 |
+ |
additional_error)) |
| 1378 |
+ |
goto failure; |
| 1379 |
+ |
|
| 1380 |
+ |
} |
| 1381 |
|
/* g(z). */ |
| 1382 |
|
else if (strcmp (long_options[option_index].name, "gofz") == 0) |
| 1383 |
|
{ |
| 1480 |
|
goto failure; |
| 1481 |
|
|
| 1482 |
|
} |
| 1483 |
+ |
/* 2D g(r) (Slab width --dz must be specified). */ |
| 1484 |
+ |
else if (strcmp (long_options[option_index].name, "twodgofr") == 0) |
| 1485 |
+ |
{ |
| 1486 |
+ |
|
| 1487 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1488 |
+ |
reset_group_staticProps (args_info); |
| 1489 |
+ |
args_info->staticProps_group_counter += 1; |
| 1490 |
+ |
|
| 1491 |
+ |
if (update_arg( 0 , |
| 1492 |
+ |
0 , &(args_info->twodgofr_given), |
| 1493 |
+ |
&(local_args_info.twodgofr_given), optarg, 0, 0, ARG_NO, |
| 1494 |
+ |
check_ambiguity, override, 0, 0, |
| 1495 |
+ |
"twodgofr", '-', |
| 1496 |
+ |
additional_error)) |
| 1497 |
+ |
goto failure; |
| 1498 |
+ |
|
| 1499 |
+ |
} |
| 1500 |
|
/* rp2 order parameter (--sele1 and --sele2 must be specified). */ |
| 1501 |
|
else if (strcmp (long_options[option_index].name, "rp2") == 0) |
| 1502 |
|
{ |
| 1531 |
|
goto failure; |
| 1532 |
|
|
| 1533 |
|
} |
| 1534 |
< |
/* p(cos(theta)). */ |
| 1534 |
> |
/* p(cos(theta)) (--sele1 must be specified, --sele2 is optional). */ |
| 1535 |
|
else if (strcmp (long_options[option_index].name, "p_angle") == 0) |
| 1536 |
|
{ |
| 1537 |
|
|
| 1582 |
|
goto failure; |
| 1583 |
|
|
| 1584 |
|
} |
| 1585 |
+ |
/* angle of R. */ |
| 1586 |
+ |
else if (strcmp (long_options[option_index].name, "angle_r") == 0) |
| 1587 |
+ |
{ |
| 1588 |
+ |
|
| 1589 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1590 |
+ |
reset_group_staticProps (args_info); |
| 1591 |
+ |
args_info->staticProps_group_counter += 1; |
| 1592 |
+ |
|
| 1593 |
+ |
if (update_arg( 0 , |
| 1594 |
+ |
0 , &(args_info->angle_r_given), |
| 1595 |
+ |
&(local_args_info.angle_r_given), optarg, 0, 0, ARG_NO, |
| 1596 |
+ |
check_ambiguity, override, 0, 0, |
| 1597 |
+ |
"angle_r", '-', |
| 1598 |
+ |
additional_error)) |
| 1599 |
+ |
goto failure; |
| 1600 |
+ |
|
| 1601 |
+ |
} |
| 1602 |
|
/* hull volume of nanoparticle. */ |
| 1603 |
|
else if (strcmp (long_options[option_index].name, "hullvol") == 0) |
| 1604 |
|
{ |
| 1612 |
|
&(local_args_info.hullvol_given), optarg, 0, 0, ARG_NO, |
| 1613 |
|
check_ambiguity, override, 0, 0, |
| 1614 |
|
"hullvol", '-', |
| 1615 |
+ |
additional_error)) |
| 1616 |
+ |
goto failure; |
| 1617 |
+ |
|
| 1618 |
+ |
} |
| 1619 |
+ |
/* length of nanorod. */ |
| 1620 |
+ |
else if (strcmp (long_options[option_index].name, "rodlength") == 0) |
| 1621 |
+ |
{ |
| 1622 |
+ |
|
| 1623 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1624 |
+ |
reset_group_staticProps (args_info); |
| 1625 |
+ |
args_info->staticProps_group_counter += 1; |
| 1626 |
+ |
|
| 1627 |
+ |
if (update_arg( 0 , |
| 1628 |
+ |
0 , &(args_info->rodlength_given), |
| 1629 |
+ |
&(local_args_info.rodlength_given), optarg, 0, 0, ARG_NO, |
| 1630 |
+ |
check_ambiguity, override, 0, 0, |
| 1631 |
+ |
"rodlength", '-', |
| 1632 |
|
additional_error)) |
| 1633 |
|
goto failure; |
| 1634 |
|
|
| 1635 |
|
} |
| 1636 |
+ |
/* spatially-resolved tetrahedrality order parameter Qk(z). */ |
| 1637 |
+ |
else if (strcmp (long_options[option_index].name, "tet_param_z") == 0) |
| 1638 |
+ |
{ |
| 1639 |
|
|
| 1640 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1641 |
+ |
reset_group_staticProps (args_info); |
| 1642 |
+ |
args_info->staticProps_group_counter += 1; |
| 1643 |
+ |
|
| 1644 |
+ |
if (update_arg( 0 , |
| 1645 |
+ |
0 , &(args_info->tet_param_z_given), |
| 1646 |
+ |
&(local_args_info.tet_param_z_given), optarg, 0, 0, ARG_NO, |
| 1647 |
+ |
check_ambiguity, override, 0, 0, |
| 1648 |
+ |
"tet_param_z", '-', |
| 1649 |
+ |
additional_error)) |
| 1650 |
+ |
goto failure; |
| 1651 |
+ |
|
| 1652 |
+ |
} |
| 1653 |
+ |
/* slab-resolved RNEMD statistics (temperature, density, velocity). */ |
| 1654 |
+ |
else if (strcmp (long_options[option_index].name, "rnemdz") == 0) |
| 1655 |
+ |
{ |
| 1656 |
+ |
|
| 1657 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1658 |
+ |
reset_group_staticProps (args_info); |
| 1659 |
+ |
args_info->staticProps_group_counter += 1; |
| 1660 |
+ |
|
| 1661 |
+ |
if (update_arg( 0 , |
| 1662 |
+ |
0 , &(args_info->rnemdz_given), |
| 1663 |
+ |
&(local_args_info.rnemdz_given), optarg, 0, 0, ARG_NO, |
| 1664 |
+ |
check_ambiguity, override, 0, 0, |
| 1665 |
+ |
"rnemdz", '-', |
| 1666 |
+ |
additional_error)) |
| 1667 |
+ |
goto failure; |
| 1668 |
+ |
|
| 1669 |
+ |
} |
| 1670 |
+ |
/* shell-resolved RNEMD statistics (temperature, density, angular velocity). */ |
| 1671 |
+ |
else if (strcmp (long_options[option_index].name, "rnemdr") == 0) |
| 1672 |
+ |
{ |
| 1673 |
+ |
|
| 1674 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1675 |
+ |
reset_group_staticProps (args_info); |
| 1676 |
+ |
args_info->staticProps_group_counter += 1; |
| 1677 |
+ |
|
| 1678 |
+ |
if (update_arg( 0 , |
| 1679 |
+ |
0 , &(args_info->rnemdr_given), |
| 1680 |
+ |
&(local_args_info.rnemdr_given), optarg, 0, 0, ARG_NO, |
| 1681 |
+ |
check_ambiguity, override, 0, 0, |
| 1682 |
+ |
"rnemdr", '-', |
| 1683 |
+ |
additional_error)) |
| 1684 |
+ |
goto failure; |
| 1685 |
+ |
|
| 1686 |
+ |
} |
| 1687 |
+ |
/* shell and angle-resolved RNEMD statistics (temperature, density, angular velocity). */ |
| 1688 |
+ |
else if (strcmp (long_options[option_index].name, "rnemdrt") == 0) |
| 1689 |
+ |
{ |
| 1690 |
+ |
|
| 1691 |
+ |
if (args_info->staticProps_group_counter && override) |
| 1692 |
+ |
reset_group_staticProps (args_info); |
| 1693 |
+ |
args_info->staticProps_group_counter += 1; |
| 1694 |
+ |
|
| 1695 |
+ |
if (update_arg( 0 , |
| 1696 |
+ |
0 , &(args_info->rnemdrt_given), |
| 1697 |
+ |
&(local_args_info.rnemdrt_given), optarg, 0, 0, ARG_NO, |
| 1698 |
+ |
check_ambiguity, override, 0, 0, |
| 1699 |
+ |
"rnemdrt", '-', |
| 1700 |
+ |
additional_error)) |
| 1701 |
+ |
goto failure; |
| 1702 |
+ |
|
| 1703 |
+ |
} |
| 1704 |
+ |
|
| 1705 |
|
break; |
| 1706 |
|
case '?': /* Invalid option. */ |
| 1707 |
|
/* `getopt_long' already printed an error message. */ |
| 1715 |
|
|
| 1716 |
|
if (args_info->staticProps_group_counter > 1) |
| 1717 |
|
{ |
| 1718 |
< |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
| 1718 |
> |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required%s.\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
| 1719 |
|
error = 1; |
| 1720 |
|
} |
| 1721 |
|
|
| 1731 |
|
if ( error ) |
| 1732 |
|
return (EXIT_FAILURE); |
| 1733 |
|
|
| 1734 |
+ |
if (optind < argc) |
| 1735 |
+ |
{ |
| 1736 |
+ |
int i = 0 ; |
| 1737 |
+ |
int found_prog_name = 0; |
| 1738 |
+ |
/* whether program name, i.e., argv[0], is in the remaining args |
| 1739 |
+ |
(this may happen with some implementations of getopt, |
| 1740 |
+ |
but surely not with the one included by gengetopt) */ |
| 1741 |
+ |
|
| 1742 |
+ |
i = optind; |
| 1743 |
+ |
while (i < argc) |
| 1744 |
+ |
if (argv[i++] == argv[0]) { |
| 1745 |
+ |
found_prog_name = 1; |
| 1746 |
+ |
break; |
| 1747 |
+ |
} |
| 1748 |
+ |
i = 0; |
| 1749 |
+ |
|
| 1750 |
+ |
args_info->inputs_num = argc - optind - found_prog_name; |
| 1751 |
+ |
args_info->inputs = |
| 1752 |
+ |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
| 1753 |
+ |
while (optind < argc) |
| 1754 |
+ |
if (argv[optind++] != argv[0]) |
| 1755 |
+ |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind-1]) ; |
| 1756 |
+ |
} |
| 1757 |
+ |
|
| 1758 |
|
return 0; |
| 1759 |
|
|
| 1760 |
|
failure: |