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