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