| 1 | tim | 320 | /* | 
| 2 | xsun | 1183 | File autogenerated by gengetopt version 2.16 | 
| 3 | tim | 320 | generated with the following command: | 
| 4 | xsun | 1183 | gengetopt -F DynamicPropsCmd | 
| 5 | tim | 320 |  | 
| 6 |  |  | The developers of gengetopt consider the fixed text that goes in all | 
| 7 |  |  | gengetopt output files to be in the public domain: | 
| 8 |  |  | we make no copyright claims on it. | 
| 9 |  |  | */ | 
| 10 |  |  |  | 
| 11 | chuckv | 1098 | /* If we use autoconf.  */ | 
| 12 |  |  | #ifdef HAVE_CONFIG_H | 
| 13 |  |  | #include "config.h" | 
| 14 |  |  | #endif | 
| 15 | tim | 320 |  | 
| 16 |  |  | #include <stdio.h> | 
| 17 |  |  | #include <stdlib.h> | 
| 18 |  |  | #include <string.h> | 
| 19 |  |  |  | 
| 20 |  |  | #include "getopt.h" | 
| 21 |  |  |  | 
| 22 |  |  | #include "DynamicPropsCmd.h" | 
| 23 |  |  |  | 
| 24 | chuckv | 1098 | static | 
| 25 |  |  | void clear_given (struct gengetopt_args_info *args_info); | 
| 26 |  |  | static | 
| 27 |  |  | void clear_args (struct gengetopt_args_info *args_info); | 
| 28 |  |  |  | 
| 29 |  |  | static int | 
| 30 |  |  | cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error); | 
| 31 |  |  |  | 
| 32 |  |  | static int | 
| 33 |  |  | cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); | 
| 34 |  |  |  | 
| 35 |  |  | static char * | 
| 36 |  |  | gengetopt_strdup (const char *s); | 
| 37 |  |  |  | 
| 38 |  |  | static | 
| 39 |  |  | void clear_given (struct gengetopt_args_info *args_info) | 
| 40 |  |  | { | 
| 41 |  |  | args_info->help_given = 0 ; | 
| 42 |  |  | args_info->version_given = 0 ; | 
| 43 |  |  | args_info->input_given = 0 ; | 
| 44 |  |  | args_info->output_given = 0 ; | 
| 45 |  |  | args_info->sele1_given = 0 ; | 
| 46 |  |  | args_info->sele2_given = 0 ; | 
| 47 |  |  | args_info->order_given = 0 ; | 
| 48 |  |  | args_info->rcorr_given = 0 ; | 
| 49 |  |  | args_info->vcorr_given = 0 ; | 
| 50 |  |  | args_info->dcorr_given = 0 ; | 
| 51 |  |  | args_info->lcorr_given = 0 ; | 
| 52 |  |  | args_info->r_rcorr_given = 0 ; | 
| 53 | chuckv | 1112 | args_info->thetacorr_given = 0 ; | 
| 54 | xsun | 1183 | args_info->actioncorr_given = 0 ; | 
| 55 |  |  | args_info->drcorr_given = 0 ; | 
| 56 | chuckv | 1098 | args_info->dynamicProps_group_counter = 0 ; | 
| 57 |  |  | } | 
| 58 |  |  |  | 
| 59 |  |  | static | 
| 60 |  |  | void clear_args (struct gengetopt_args_info *args_info) | 
| 61 |  |  | { | 
| 62 |  |  | args_info->input_arg = NULL; | 
| 63 |  |  | args_info->input_orig = NULL; | 
| 64 |  |  | args_info->output_arg = NULL; | 
| 65 |  |  | args_info->output_orig = NULL; | 
| 66 |  |  | args_info->sele1_arg = NULL; | 
| 67 |  |  | args_info->sele1_orig = NULL; | 
| 68 |  |  | args_info->sele2_arg = NULL; | 
| 69 |  |  | args_info->sele2_orig = NULL; | 
| 70 |  |  | args_info->order_orig = NULL; | 
| 71 |  |  |  | 
| 72 |  |  | } | 
| 73 |  |  |  | 
| 74 | tim | 320 | void | 
| 75 |  |  | cmdline_parser_print_version (void) | 
| 76 |  |  | { | 
| 77 |  |  | printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); | 
| 78 |  |  | } | 
| 79 |  |  |  | 
| 80 |  |  | void | 
| 81 |  |  | cmdline_parser_print_help (void) | 
| 82 |  |  | { | 
| 83 |  |  | cmdline_parser_print_version (); | 
| 84 | xsun | 1183 | printf("\nUsage: DynamicProps [OPTIONS]...\n\n"); | 
| 85 | chuckv | 1098 | printf("%s\n","  -h, --help                    Print help and exit"); | 
| 86 |  |  | printf("%s\n","  -V, --version                 Print version and exit"); | 
| 87 |  |  | printf("%s\n","  -i, --input=filename          input dump file"); | 
| 88 |  |  | printf("%s\n","  -o, --output=filename         output file name"); | 
| 89 |  |  | printf("%s\n","      --sele1=selection script  select first stuntdouble set"); | 
| 90 |  |  | printf("%s\n","      --sele2=selection script  select second stuntdouble set (if sele2 is not \n                                  set, use script from sele1)"); | 
| 91 |  |  | printf("%s\n","      --order=INT               Lengendre Polynomial Order"); | 
| 92 |  |  | printf("%s\n","\n Group: dynamicProps\n   an option of this group is required"); | 
| 93 |  |  | printf("%s\n","  -r, --rcorr                   rmsd"); | 
| 94 |  |  | printf("%s\n","  -v, --vcorr                   velocity correlation function"); | 
| 95 |  |  | printf("%s\n","  -d, --dcorr                   dipole correlation function"); | 
| 96 |  |  | printf("%s\n","  -l, --lcorr                   Lengendre correlation function"); | 
| 97 |  |  | printf("%s\n","      --r_rcorr                 Radial rmsd"); | 
| 98 | chuckv | 1112 | printf("%s\n","      --thetacorr               Angular rmsd"); | 
| 99 | xsun | 1183 | printf("%s\n","      --actioncorr              Action correlation function"); | 
| 100 |  |  | printf("%s\n","      --drcorr                  Directional rmsd for particles with unit \n                                  vectors"); | 
| 101 | chuckv | 1098 |  | 
| 102 | tim | 320 | } | 
| 103 |  |  |  | 
| 104 | chuckv | 1098 | void | 
| 105 |  |  | cmdline_parser_init (struct gengetopt_args_info *args_info) | 
| 106 |  |  | { | 
| 107 |  |  | clear_given (args_info); | 
| 108 |  |  | clear_args (args_info); | 
| 109 |  |  | } | 
| 110 | tim | 320 |  | 
| 111 | chuckv | 1098 | static void | 
| 112 |  |  | cmdline_parser_release (struct gengetopt_args_info *args_info) | 
| 113 |  |  | { | 
| 114 |  |  |  | 
| 115 |  |  | if (args_info->input_arg) | 
| 116 |  |  | { | 
| 117 |  |  | free (args_info->input_arg); /* free previous argument */ | 
| 118 |  |  | args_info->input_arg = 0; | 
| 119 |  |  | } | 
| 120 |  |  | if (args_info->input_orig) | 
| 121 |  |  | { | 
| 122 |  |  | free (args_info->input_orig); /* free previous argument */ | 
| 123 |  |  | args_info->input_orig = 0; | 
| 124 |  |  | } | 
| 125 |  |  | if (args_info->output_arg) | 
| 126 |  |  | { | 
| 127 |  |  | free (args_info->output_arg); /* free previous argument */ | 
| 128 |  |  | args_info->output_arg = 0; | 
| 129 |  |  | } | 
| 130 |  |  | if (args_info->output_orig) | 
| 131 |  |  | { | 
| 132 |  |  | free (args_info->output_orig); /* free previous argument */ | 
| 133 |  |  | args_info->output_orig = 0; | 
| 134 |  |  | } | 
| 135 |  |  | if (args_info->sele1_arg) | 
| 136 |  |  | { | 
| 137 |  |  | free (args_info->sele1_arg); /* free previous argument */ | 
| 138 |  |  | args_info->sele1_arg = 0; | 
| 139 |  |  | } | 
| 140 |  |  | if (args_info->sele1_orig) | 
| 141 |  |  | { | 
| 142 |  |  | free (args_info->sele1_orig); /* free previous argument */ | 
| 143 |  |  | args_info->sele1_orig = 0; | 
| 144 |  |  | } | 
| 145 |  |  | if (args_info->sele2_arg) | 
| 146 |  |  | { | 
| 147 |  |  | free (args_info->sele2_arg); /* free previous argument */ | 
| 148 |  |  | args_info->sele2_arg = 0; | 
| 149 |  |  | } | 
| 150 |  |  | if (args_info->sele2_orig) | 
| 151 |  |  | { | 
| 152 |  |  | free (args_info->sele2_orig); /* free previous argument */ | 
| 153 |  |  | args_info->sele2_orig = 0; | 
| 154 |  |  | } | 
| 155 |  |  | if (args_info->order_orig) | 
| 156 |  |  | { | 
| 157 |  |  | free (args_info->order_orig); /* free previous argument */ | 
| 158 |  |  | args_info->order_orig = 0; | 
| 159 |  |  | } | 
| 160 |  |  |  | 
| 161 |  |  | clear_given (args_info); | 
| 162 |  |  | } | 
| 163 | tim | 320 |  | 
| 164 | chuckv | 1098 | int | 
| 165 |  |  | cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) | 
| 166 |  |  | { | 
| 167 |  |  | FILE *outfile; | 
| 168 |  |  | int i = 0; | 
| 169 |  |  |  | 
| 170 |  |  | outfile = fopen(filename, "w"); | 
| 171 |  |  |  | 
| 172 |  |  | if (!outfile) | 
| 173 |  |  | { | 
| 174 |  |  | fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); | 
| 175 |  |  | return EXIT_FAILURE; | 
| 176 |  |  | } | 
| 177 |  |  |  | 
| 178 |  |  | if (args_info->help_given) { | 
| 179 |  |  | fprintf(outfile, "%s\n", "help"); | 
| 180 |  |  | } | 
| 181 |  |  | if (args_info->version_given) { | 
| 182 |  |  | fprintf(outfile, "%s\n", "version"); | 
| 183 |  |  | } | 
| 184 |  |  | if (args_info->input_given) { | 
| 185 |  |  | if (args_info->input_orig) { | 
| 186 |  |  | fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); | 
| 187 |  |  | } else { | 
| 188 |  |  | fprintf(outfile, "%s\n", "input"); | 
| 189 |  |  | } | 
| 190 |  |  | } | 
| 191 |  |  | if (args_info->output_given) { | 
| 192 |  |  | if (args_info->output_orig) { | 
| 193 |  |  | fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); | 
| 194 |  |  | } else { | 
| 195 |  |  | fprintf(outfile, "%s\n", "output"); | 
| 196 |  |  | } | 
| 197 |  |  | } | 
| 198 |  |  | if (args_info->sele1_given) { | 
| 199 |  |  | if (args_info->sele1_orig) { | 
| 200 |  |  | fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); | 
| 201 |  |  | } else { | 
| 202 |  |  | fprintf(outfile, "%s\n", "sele1"); | 
| 203 |  |  | } | 
| 204 |  |  | } | 
| 205 |  |  | if (args_info->sele2_given) { | 
| 206 |  |  | if (args_info->sele2_orig) { | 
| 207 |  |  | fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); | 
| 208 |  |  | } else { | 
| 209 |  |  | fprintf(outfile, "%s\n", "sele2"); | 
| 210 |  |  | } | 
| 211 |  |  | } | 
| 212 |  |  | if (args_info->order_given) { | 
| 213 |  |  | if (args_info->order_orig) { | 
| 214 |  |  | fprintf(outfile, "%s=\"%s\"\n", "order", args_info->order_orig); | 
| 215 |  |  | } else { | 
| 216 |  |  | fprintf(outfile, "%s\n", "order"); | 
| 217 |  |  | } | 
| 218 |  |  | } | 
| 219 |  |  | if (args_info->rcorr_given) { | 
| 220 |  |  | fprintf(outfile, "%s\n", "rcorr"); | 
| 221 |  |  | } | 
| 222 |  |  | if (args_info->vcorr_given) { | 
| 223 |  |  | fprintf(outfile, "%s\n", "vcorr"); | 
| 224 |  |  | } | 
| 225 |  |  | if (args_info->dcorr_given) { | 
| 226 |  |  | fprintf(outfile, "%s\n", "dcorr"); | 
| 227 |  |  | } | 
| 228 |  |  | if (args_info->lcorr_given) { | 
| 229 |  |  | fprintf(outfile, "%s\n", "lcorr"); | 
| 230 |  |  | } | 
| 231 |  |  | if (args_info->r_rcorr_given) { | 
| 232 |  |  | fprintf(outfile, "%s\n", "r_rcorr"); | 
| 233 |  |  | } | 
| 234 | chuckv | 1112 | if (args_info->thetacorr_given) { | 
| 235 |  |  | fprintf(outfile, "%s\n", "thetacorr"); | 
| 236 |  |  | } | 
| 237 | xsun | 1183 | if (args_info->actioncorr_given) { | 
| 238 |  |  | fprintf(outfile, "%s\n", "actioncorr"); | 
| 239 |  |  | } | 
| 240 |  |  | if (args_info->drcorr_given) { | 
| 241 |  |  | fprintf(outfile, "%s\n", "drcorr"); | 
| 242 |  |  | } | 
| 243 | chuckv | 1098 |  | 
| 244 |  |  | fclose (outfile); | 
| 245 |  |  |  | 
| 246 |  |  | i = EXIT_SUCCESS; | 
| 247 |  |  | return i; | 
| 248 |  |  | } | 
| 249 |  |  |  | 
| 250 |  |  | void | 
| 251 |  |  | cmdline_parser_free (struct gengetopt_args_info *args_info) | 
| 252 |  |  | { | 
| 253 |  |  | cmdline_parser_release (args_info); | 
| 254 |  |  | } | 
| 255 |  |  |  | 
| 256 |  |  |  | 
| 257 | tim | 320 | /* gengetopt_strdup() */ | 
| 258 |  |  | /* strdup.c replacement of strdup, which is not standard */ | 
| 259 |  |  | char * | 
| 260 |  |  | gengetopt_strdup (const char *s) | 
| 261 |  |  | { | 
| 262 | chuckv | 1098 | char *result = NULL; | 
| 263 |  |  | if (!s) | 
| 264 |  |  | return result; | 
| 265 |  |  |  | 
| 266 |  |  | result = (char*)malloc(strlen(s) + 1); | 
| 267 | tim | 320 | if (result == (char*)0) | 
| 268 |  |  | return (char*)0; | 
| 269 |  |  | strcpy(result, s); | 
| 270 |  |  | return result; | 
| 271 |  |  | } | 
| 272 |  |  |  | 
| 273 | chuckv | 1098 | static void | 
| 274 |  |  | reset_group_dynamicProps(struct gengetopt_args_info *args_info); | 
| 275 |  |  |  | 
| 276 |  |  | static void | 
| 277 |  |  | reset_group_dynamicProps(struct gengetopt_args_info *args_info) | 
| 278 | tim | 320 | { | 
| 279 | chuckv | 1098 | if (! args_info->dynamicProps_group_counter) | 
| 280 |  |  | return; | 
| 281 | tim | 320 |  | 
| 282 |  |  | args_info->rcorr_given = 0 ; | 
| 283 |  |  | args_info->vcorr_given = 0 ; | 
| 284 |  |  | args_info->dcorr_given = 0 ; | 
| 285 | tim | 876 | args_info->lcorr_given = 0 ; | 
| 286 | chuckv | 1098 | args_info->r_rcorr_given = 0 ; | 
| 287 | chuckv | 1112 | args_info->thetacorr_given = 0 ; | 
| 288 | xsun | 1183 | args_info->actioncorr_given = 0 ; | 
| 289 |  |  | args_info->drcorr_given = 0 ; | 
| 290 | chuckv | 1098 |  | 
| 291 |  |  | args_info->dynamicProps_group_counter = 0; | 
| 292 | tim | 876 | } | 
| 293 | tim | 320 |  | 
| 294 | chuckv | 1098 | int | 
| 295 |  |  | cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) | 
| 296 |  |  | { | 
| 297 |  |  | return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); | 
| 298 |  |  | } | 
| 299 | tim | 320 |  | 
| 300 | chuckv | 1098 | int | 
| 301 |  |  | cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) | 
| 302 |  |  | { | 
| 303 |  |  | int result; | 
| 304 |  |  |  | 
| 305 |  |  | result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); | 
| 306 |  |  |  | 
| 307 |  |  | if (result == EXIT_FAILURE) | 
| 308 |  |  | { | 
| 309 |  |  | cmdline_parser_free (args_info); | 
| 310 |  |  | exit (EXIT_FAILURE); | 
| 311 |  |  | } | 
| 312 |  |  |  | 
| 313 |  |  | return result; | 
| 314 |  |  | } | 
| 315 |  |  |  | 
| 316 |  |  | int | 
| 317 |  |  | cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) | 
| 318 |  |  | { | 
| 319 |  |  | int result = EXIT_SUCCESS; | 
| 320 |  |  |  | 
| 321 |  |  | if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) | 
| 322 |  |  | result = EXIT_FAILURE; | 
| 323 |  |  |  | 
| 324 |  |  | if (result == EXIT_FAILURE) | 
| 325 |  |  | { | 
| 326 |  |  | cmdline_parser_free (args_info); | 
| 327 |  |  | exit (EXIT_FAILURE); | 
| 328 |  |  | } | 
| 329 |  |  |  | 
| 330 |  |  | return result; | 
| 331 |  |  | } | 
| 332 |  |  |  | 
| 333 |  |  | int | 
| 334 |  |  | cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) | 
| 335 |  |  | { | 
| 336 |  |  | int error = 0; | 
| 337 |  |  |  | 
| 338 |  |  | if (! args_info->input_given) | 
| 339 |  |  | { | 
| 340 |  |  | fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); | 
| 341 |  |  | error = 1; | 
| 342 |  |  | } | 
| 343 |  |  | if (args_info->dynamicProps_group_counter == 0) | 
| 344 |  |  | { | 
| 345 |  |  | fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", prog_name, args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); | 
| 346 |  |  | error = 1; | 
| 347 |  |  | } | 
| 348 |  |  |  | 
| 349 |  |  |  | 
| 350 |  |  | return error; | 
| 351 |  |  | } | 
| 352 |  |  |  | 
| 353 |  |  | int | 
| 354 |  |  | cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error) | 
| 355 |  |  | { | 
| 356 |  |  | int c;        /* Character of the parsed option.  */ | 
| 357 |  |  |  | 
| 358 |  |  | int error = 0; | 
| 359 |  |  | struct gengetopt_args_info local_args_info; | 
| 360 |  |  |  | 
| 361 |  |  | if (initialize) | 
| 362 |  |  | cmdline_parser_init (args_info); | 
| 363 |  |  |  | 
| 364 |  |  | cmdline_parser_init (&local_args_info); | 
| 365 |  |  |  | 
| 366 | tim | 320 | optarg = 0; | 
| 367 | xsun | 1183 | optind = 0; | 
| 368 | tim | 320 | opterr = 1; | 
| 369 |  |  | optopt = '?'; | 
| 370 |  |  |  | 
| 371 |  |  | while (1) | 
| 372 |  |  | { | 
| 373 |  |  | int option_index = 0; | 
| 374 |  |  | char *stop_char; | 
| 375 |  |  |  | 
| 376 |  |  | static struct option long_options[] = { | 
| 377 |  |  | { "help",       0, NULL, 'h' }, | 
| 378 |  |  | { "version",    0, NULL, 'V' }, | 
| 379 |  |  | { "input",      1, NULL, 'i' }, | 
| 380 |  |  | { "output",     1, NULL, 'o' }, | 
| 381 |  |  | { "sele1",      1, NULL, 0 }, | 
| 382 |  |  | { "sele2",      1, NULL, 0 }, | 
| 383 | tim | 876 | { "order",      1, NULL, 0 }, | 
| 384 | tim | 320 | { "rcorr",      0, NULL, 'r' }, | 
| 385 |  |  | { "vcorr",      0, NULL, 'v' }, | 
| 386 |  |  | { "dcorr",      0, NULL, 'd' }, | 
| 387 | tim | 876 | { "lcorr",      0, NULL, 'l' }, | 
| 388 | chuckv | 1098 | { "r_rcorr",    0, NULL, 0 }, | 
| 389 | chuckv | 1112 | { "thetacorr",  0, NULL, 0 }, | 
| 390 | xsun | 1183 | { "actioncorr", 0, NULL, 0 }, | 
| 391 |  |  | { "drcorr",     0, NULL, 0 }, | 
| 392 | tim | 320 | { NULL, 0, NULL, 0 } | 
| 393 |  |  | }; | 
| 394 |  |  |  | 
| 395 |  |  | stop_char = 0; | 
| 396 | tim | 917 | c = getopt_long (argc, argv, "hVi:o:rvdl", long_options, &option_index); | 
| 397 | tim | 320 |  | 
| 398 |  |  | if (c == -1) break;       /* Exit from `while (1)' loop.  */ | 
| 399 |  |  |  | 
| 400 |  |  | switch (c) | 
| 401 |  |  | { | 
| 402 |  |  | case 'h':       /* Print help and exit.  */ | 
| 403 |  |  | cmdline_parser_print_help (); | 
| 404 | chuckv | 1098 | cmdline_parser_free (&local_args_info); | 
| 405 | tim | 320 | exit (EXIT_SUCCESS); | 
| 406 |  |  |  | 
| 407 |  |  | case 'V':       /* Print version and exit.  */ | 
| 408 |  |  | cmdline_parser_print_version (); | 
| 409 | chuckv | 1098 | cmdline_parser_free (&local_args_info); | 
| 410 | tim | 320 | exit (EXIT_SUCCESS); | 
| 411 |  |  |  | 
| 412 |  |  | case 'i':       /* input dump file.  */ | 
| 413 | chuckv | 1098 | if (local_args_info.input_given) | 
| 414 | tim | 320 | { | 
| 415 | chuckv | 1098 | fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 416 |  |  | goto failure; | 
| 417 | tim | 320 | } | 
| 418 | chuckv | 1098 | if (args_info->input_given && ! override) | 
| 419 |  |  | continue; | 
| 420 |  |  | local_args_info.input_given = 1; | 
| 421 | tim | 320 | args_info->input_given = 1; | 
| 422 | chuckv | 1098 | if (args_info->input_arg) | 
| 423 |  |  | free (args_info->input_arg); /* free previous string */ | 
| 424 | tim | 320 | args_info->input_arg = gengetopt_strdup (optarg); | 
| 425 | chuckv | 1098 | if (args_info->input_orig) | 
| 426 |  |  | free (args_info->input_orig); /* free previous string */ | 
| 427 |  |  | args_info->input_orig = gengetopt_strdup (optarg); | 
| 428 | tim | 320 | break; | 
| 429 |  |  |  | 
| 430 |  |  | case 'o':       /* output file name.  */ | 
| 431 | chuckv | 1098 | if (local_args_info.output_given) | 
| 432 | tim | 320 | { | 
| 433 | chuckv | 1098 | fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 434 |  |  | goto failure; | 
| 435 | tim | 320 | } | 
| 436 | chuckv | 1098 | if (args_info->output_given && ! override) | 
| 437 |  |  | continue; | 
| 438 |  |  | local_args_info.output_given = 1; | 
| 439 | tim | 320 | args_info->output_given = 1; | 
| 440 | chuckv | 1098 | if (args_info->output_arg) | 
| 441 |  |  | free (args_info->output_arg); /* free previous string */ | 
| 442 | tim | 320 | args_info->output_arg = gengetopt_strdup (optarg); | 
| 443 | chuckv | 1098 | if (args_info->output_orig) | 
| 444 |  |  | free (args_info->output_orig); /* free previous string */ | 
| 445 |  |  | args_info->output_orig = gengetopt_strdup (optarg); | 
| 446 | tim | 320 | break; | 
| 447 |  |  |  | 
| 448 | tim | 917 | case 'r':       /* rmsd.  */ | 
| 449 | chuckv | 1098 | if (local_args_info.rcorr_given) | 
| 450 | tim | 320 | { | 
| 451 | chuckv | 1098 | fprintf (stderr, "%s: `--rcorr' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 452 |  |  | goto failure; | 
| 453 | tim | 320 | } | 
| 454 | chuckv | 1098 | if (args_info->rcorr_given && ! override) | 
| 455 |  |  | continue; | 
| 456 |  |  | local_args_info.rcorr_given = 1; | 
| 457 | tim | 320 | args_info->rcorr_given = 1; | 
| 458 | chuckv | 1098 | if (args_info->dynamicProps_group_counter && override) | 
| 459 |  |  | reset_group_dynamicProps (args_info); | 
| 460 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 461 |  |  | break; | 
| 462 | tim | 320 |  | 
| 463 |  |  | case 'v':       /* velocity correlation function.  */ | 
| 464 | chuckv | 1098 | if (local_args_info.vcorr_given) | 
| 465 | tim | 320 | { | 
| 466 | chuckv | 1098 | fprintf (stderr, "%s: `--vcorr' (`-v') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 467 |  |  | goto failure; | 
| 468 | tim | 320 | } | 
| 469 | chuckv | 1098 | if (args_info->vcorr_given && ! override) | 
| 470 |  |  | continue; | 
| 471 |  |  | local_args_info.vcorr_given = 1; | 
| 472 | tim | 320 | args_info->vcorr_given = 1; | 
| 473 | chuckv | 1098 | if (args_info->dynamicProps_group_counter && override) | 
| 474 |  |  | reset_group_dynamicProps (args_info); | 
| 475 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 476 |  |  | break; | 
| 477 | tim | 320 |  | 
| 478 |  |  | case 'd':       /* dipole correlation function.  */ | 
| 479 | chuckv | 1098 | if (local_args_info.dcorr_given) | 
| 480 | tim | 320 | { | 
| 481 | chuckv | 1098 | fprintf (stderr, "%s: `--dcorr' (`-d') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 482 |  |  | goto failure; | 
| 483 | tim | 320 | } | 
| 484 | chuckv | 1098 | if (args_info->dcorr_given && ! override) | 
| 485 |  |  | continue; | 
| 486 |  |  | local_args_info.dcorr_given = 1; | 
| 487 | tim | 320 | args_info->dcorr_given = 1; | 
| 488 | chuckv | 1098 | if (args_info->dynamicProps_group_counter && override) | 
| 489 |  |  | reset_group_dynamicProps (args_info); | 
| 490 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 491 |  |  | break; | 
| 492 | tim | 320 |  | 
| 493 | tim | 876 | case 'l':       /* Lengendre correlation function.  */ | 
| 494 | chuckv | 1098 | if (local_args_info.lcorr_given) | 
| 495 | tim | 876 | { | 
| 496 | chuckv | 1098 | fprintf (stderr, "%s: `--lcorr' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 497 |  |  | goto failure; | 
| 498 | tim | 876 | } | 
| 499 | chuckv | 1098 | if (args_info->lcorr_given && ! override) | 
| 500 |  |  | continue; | 
| 501 |  |  | local_args_info.lcorr_given = 1; | 
| 502 | tim | 876 | args_info->lcorr_given = 1; | 
| 503 | chuckv | 1098 | if (args_info->dynamicProps_group_counter && override) | 
| 504 |  |  | reset_group_dynamicProps (args_info); | 
| 505 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 506 |  |  | break; | 
| 507 | tim | 320 |  | 
| 508 | tim | 876 |  | 
| 509 | tim | 320 | case 0: /* Long option with no short option */ | 
| 510 |  |  | /* select first stuntdouble set.  */ | 
| 511 |  |  | if (strcmp (long_options[option_index].name, "sele1") == 0) | 
| 512 | tim | 876 | { | 
| 513 | chuckv | 1098 | if (local_args_info.sele1_given) | 
| 514 | tim | 876 | { | 
| 515 | chuckv | 1098 | fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 516 |  |  | goto failure; | 
| 517 | tim | 876 | } | 
| 518 | chuckv | 1098 | if (args_info->sele1_given && ! override) | 
| 519 |  |  | continue; | 
| 520 |  |  | local_args_info.sele1_given = 1; | 
| 521 | tim | 876 | args_info->sele1_given = 1; | 
| 522 | chuckv | 1098 | if (args_info->sele1_arg) | 
| 523 |  |  | free (args_info->sele1_arg); /* free previous string */ | 
| 524 | tim | 876 | args_info->sele1_arg = gengetopt_strdup (optarg); | 
| 525 | chuckv | 1098 | if (args_info->sele1_orig) | 
| 526 |  |  | free (args_info->sele1_orig); /* free previous string */ | 
| 527 |  |  | args_info->sele1_orig = gengetopt_strdup (optarg); | 
| 528 | tim | 876 | } | 
| 529 | tim | 320 | /* select second stuntdouble set (if sele2 is not set, use script from sele1).  */ | 
| 530 |  |  | else if (strcmp (long_options[option_index].name, "sele2") == 0) | 
| 531 | tim | 876 | { | 
| 532 | chuckv | 1098 | if (local_args_info.sele2_given) | 
| 533 | tim | 876 | { | 
| 534 | chuckv | 1098 | fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 535 |  |  | goto failure; | 
| 536 | tim | 876 | } | 
| 537 | chuckv | 1098 | if (args_info->sele2_given && ! override) | 
| 538 |  |  | continue; | 
| 539 |  |  | local_args_info.sele2_given = 1; | 
| 540 | tim | 876 | args_info->sele2_given = 1; | 
| 541 | chuckv | 1098 | if (args_info->sele2_arg) | 
| 542 |  |  | free (args_info->sele2_arg); /* free previous string */ | 
| 543 | tim | 876 | args_info->sele2_arg = gengetopt_strdup (optarg); | 
| 544 | chuckv | 1098 | if (args_info->sele2_orig) | 
| 545 |  |  | free (args_info->sele2_orig); /* free previous string */ | 
| 546 |  |  | args_info->sele2_orig = gengetopt_strdup (optarg); | 
| 547 | tim | 876 | } | 
| 548 |  |  | /* Lengendre Polynomial Order.  */ | 
| 549 |  |  | else if (strcmp (long_options[option_index].name, "order") == 0) | 
| 550 |  |  | { | 
| 551 | chuckv | 1098 | if (local_args_info.order_given) | 
| 552 | tim | 876 | { | 
| 553 | chuckv | 1098 | fprintf (stderr, "%s: `--order' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 554 |  |  | goto failure; | 
| 555 | tim | 876 | } | 
| 556 | chuckv | 1098 | if (args_info->order_given && ! override) | 
| 557 |  |  | continue; | 
| 558 |  |  | local_args_info.order_given = 1; | 
| 559 | tim | 876 | args_info->order_given = 1; | 
| 560 | chuckv | 1098 | args_info->order_arg = strtol (optarg, &stop_char, 0); | 
| 561 |  |  | if (!(stop_char && *stop_char == '\0')) { | 
| 562 |  |  | fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); | 
| 563 |  |  | goto failure; | 
| 564 |  |  | } | 
| 565 |  |  | if (args_info->order_orig) | 
| 566 |  |  | free (args_info->order_orig); /* free previous string */ | 
| 567 |  |  | args_info->order_orig = gengetopt_strdup (optarg); | 
| 568 |  |  | } | 
| 569 |  |  | /* Radial rmsd.  */ | 
| 570 |  |  | else if (strcmp (long_options[option_index].name, "r_rcorr") == 0) | 
| 571 |  |  | { | 
| 572 |  |  | if (local_args_info.r_rcorr_given) | 
| 573 |  |  | { | 
| 574 |  |  | fprintf (stderr, "%s: `--r_rcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 575 |  |  | goto failure; | 
| 576 |  |  | } | 
| 577 |  |  | if (args_info->r_rcorr_given && ! override) | 
| 578 |  |  | continue; | 
| 579 |  |  | local_args_info.r_rcorr_given = 1; | 
| 580 |  |  | args_info->r_rcorr_given = 1; | 
| 581 |  |  | if (args_info->dynamicProps_group_counter && override) | 
| 582 |  |  | reset_group_dynamicProps (args_info); | 
| 583 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 584 | tim | 876 | break; | 
| 585 |  |  | } | 
| 586 | chuckv | 1112 | /* Angular rmsd.  */ | 
| 587 |  |  | else if (strcmp (long_options[option_index].name, "thetacorr") == 0) | 
| 588 |  |  | { | 
| 589 |  |  | if (local_args_info.thetacorr_given) | 
| 590 |  |  | { | 
| 591 |  |  | fprintf (stderr, "%s: `--thetacorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 592 |  |  | goto failure; | 
| 593 |  |  | } | 
| 594 |  |  | if (args_info->thetacorr_given && ! override) | 
| 595 |  |  | continue; | 
| 596 |  |  | local_args_info.thetacorr_given = 1; | 
| 597 |  |  | args_info->thetacorr_given = 1; | 
| 598 |  |  | if (args_info->dynamicProps_group_counter && override) | 
| 599 |  |  | reset_group_dynamicProps (args_info); | 
| 600 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 601 |  |  | break; | 
| 602 |  |  | } | 
| 603 | xsun | 1183 | /* Action correlation function.  */ | 
| 604 |  |  | else if (strcmp (long_options[option_index].name, "actioncorr") == 0) | 
| 605 |  |  | { | 
| 606 |  |  | if (local_args_info.actioncorr_given) | 
| 607 |  |  | { | 
| 608 |  |  | fprintf (stderr, "%s: `--actioncorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 609 |  |  | goto failure; | 
| 610 |  |  | } | 
| 611 |  |  | if (args_info->actioncorr_given && ! override) | 
| 612 |  |  | continue; | 
| 613 |  |  | local_args_info.actioncorr_given = 1; | 
| 614 |  |  | args_info->actioncorr_given = 1; | 
| 615 |  |  | if (args_info->dynamicProps_group_counter && override) | 
| 616 |  |  | reset_group_dynamicProps (args_info); | 
| 617 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 618 |  |  | break; | 
| 619 |  |  | } | 
| 620 |  |  | /* Directional rmsd for particles with unit vectors.  */ | 
| 621 |  |  | else if (strcmp (long_options[option_index].name, "drcorr") == 0) | 
| 622 |  |  | { | 
| 623 |  |  | if (local_args_info.drcorr_given) | 
| 624 |  |  | { | 
| 625 |  |  | fprintf (stderr, "%s: `--drcorr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); | 
| 626 |  |  | goto failure; | 
| 627 |  |  | } | 
| 628 |  |  | if (args_info->drcorr_given && ! override) | 
| 629 |  |  | continue; | 
| 630 |  |  | local_args_info.drcorr_given = 1; | 
| 631 |  |  | args_info->drcorr_given = 1; | 
| 632 |  |  | if (args_info->dynamicProps_group_counter && override) | 
| 633 |  |  | reset_group_dynamicProps (args_info); | 
| 634 |  |  | args_info->dynamicProps_group_counter += 1; | 
| 635 |  |  | break; | 
| 636 |  |  | } | 
| 637 | tim | 876 |  | 
| 638 | chuckv | 1098 | break; | 
| 639 | tim | 320 | case '?':       /* Invalid option.  */ | 
| 640 |  |  | /* `getopt_long' already printed an error message.  */ | 
| 641 | chuckv | 1098 | goto failure; | 
| 642 | tim | 320 |  | 
| 643 |  |  | default:        /* bug: option not considered.  */ | 
| 644 | chuckv | 1098 | fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); | 
| 645 | tim | 320 | abort (); | 
| 646 |  |  | } /* switch */ | 
| 647 |  |  | } /* while */ | 
| 648 |  |  |  | 
| 649 | chuckv | 1098 | if (args_info->dynamicProps_group_counter > 1) | 
| 650 | tim | 320 | { | 
| 651 | chuckv | 1098 | fprintf (stderr, "%s: %d options of group dynamicProps were given. One is required.%s\n", argv[0], args_info->dynamicProps_group_counter, (additional_error ? additional_error : "")); | 
| 652 |  |  | error = 1; | 
| 653 | tim | 320 | } | 
| 654 |  |  |  | 
| 655 |  |  |  | 
| 656 | chuckv | 1098 |  | 
| 657 |  |  | if (check_required) | 
| 658 | tim | 320 | { | 
| 659 | chuckv | 1098 | error += cmdline_parser_required2 (args_info, argv[0], additional_error); | 
| 660 | tim | 320 | } | 
| 661 |  |  |  | 
| 662 | chuckv | 1098 | cmdline_parser_release (&local_args_info); | 
| 663 |  |  |  | 
| 664 |  |  | if ( error ) | 
| 665 |  |  | return (EXIT_FAILURE); | 
| 666 |  |  |  | 
| 667 | tim | 320 | return 0; | 
| 668 | chuckv | 1098 |  | 
| 669 |  |  | failure: | 
| 670 |  |  |  | 
| 671 |  |  | cmdline_parser_release (&local_args_info); | 
| 672 |  |  | return (EXIT_FAILURE); | 
| 673 | tim | 320 | } |