1 |
|
/* |
2 |
|
File autogenerated by gengetopt version 2.12.1 |
3 |
|
generated with the following command: |
4 |
< |
gengetopt --file-name=shaperCmd |
4 |
> |
gengetopt --file-name=shaperCmd --unamed-opts=PDBFILE |
5 |
|
|
6 |
|
The developers of gengetopt consider the fixed text that goes in all |
7 |
|
gengetopt output files to be in the public domain: |
37 |
|
{ |
38 |
|
args_info->help_given = 0 ; |
39 |
|
args_info->version_given = 0 ; |
40 |
– |
args_info->input_given = 0 ; |
40 |
|
args_info->bandwidth_given = 0 ; |
41 |
|
args_info->tolerance_given = 0 ; |
42 |
|
args_info->charmm_given = 0 ; |
50 |
|
static |
51 |
|
void clear_args (struct gengetopt_args_info *args_info) |
52 |
|
{ |
54 |
– |
args_info->input_arg = NULL; |
53 |
|
args_info->bandwidth_arg = 8 ; |
54 |
|
args_info->tolerance_arg = 0.01 ; |
55 |
|
} |
65 |
|
{ |
66 |
|
cmdline_parser_print_version (); |
67 |
|
printf("\n" |
68 |
< |
"Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); |
68 |
> |
"Usage: %s [OPTIONS]... [PDBFILE]...\n", CMDLINE_PARSER_PACKAGE); |
69 |
|
printf("\n"); |
70 |
|
printf("%s\n"," -h, --help Print help and exit"); |
71 |
|
printf("%s\n"," -V, --version Print version and exit"); |
74 |
– |
printf("%s\n"," -i, --input=filename input file name"); |
72 |
|
printf("%s\n"," -b, --bandwidth=INT The step detail for the potential grids - typically \n a power of 2 (default=`8')"); |
73 |
|
printf("%s\n"," -t, --tolerance=DOUBLE The tolerance for recognition of spherical harmonic \n terms (default=`0.01')"); |
74 |
|
printf("\n"); |
85 |
|
{ |
86 |
|
clear_given (args_info); |
87 |
|
clear_args (args_info); |
88 |
+ |
|
89 |
+ |
args_info->inputs = NULL; |
90 |
+ |
args_info->inputs_num = 0; |
91 |
|
} |
92 |
|
|
93 |
|
void |
94 |
|
cmdline_parser_free (struct gengetopt_args_info *args_info) |
95 |
|
{ |
96 |
|
|
97 |
< |
if (args_info->input_arg) |
98 |
< |
{ |
99 |
< |
free (args_info->input_arg); /* free previous argument */ |
100 |
< |
args_info->input_arg = 0; |
101 |
< |
} |
97 |
> |
int i; |
98 |
|
|
99 |
+ |
for (i = 0; i < args_info->inputs_num; ++i) |
100 |
+ |
free (args_info->inputs [i]); |
101 |
+ |
|
102 |
+ |
if (args_info->inputs_num) |
103 |
+ |
free (args_info->inputs); |
104 |
+ |
|
105 |
|
clear_given (args_info); |
106 |
|
} |
107 |
|
|
187 |
|
static struct option long_options[] = { |
188 |
|
{ "help", 0, NULL, 'h' }, |
189 |
|
{ "version", 0, NULL, 'V' }, |
188 |
– |
{ "input", 1, NULL, 'i' }, |
190 |
|
{ "bandwidth", 1, NULL, 'b' }, |
191 |
|
{ "tolerance", 1, NULL, 't' }, |
192 |
|
{ "charmm", 0, NULL, 'c' }, |
198 |
|
}; |
199 |
|
|
200 |
|
stop_char = 0; |
201 |
< |
c = getopt_long (argc, argv, "hVi:b:t:calgo", long_options, &option_index); |
201 |
> |
c = getopt_long (argc, argv, "hVb:t:calgo", long_options, &option_index); |
202 |
|
|
203 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
204 |
|
|
211 |
|
case 'V': /* Print version and exit. */ |
212 |
|
cmdline_parser_print_version (); |
213 |
|
exit (EXIT_SUCCESS); |
213 |
– |
|
214 |
– |
case 'i': /* input file name. */ |
215 |
– |
if (local_args_info.input_given) |
216 |
– |
{ |
217 |
– |
fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
218 |
– |
goto failure; |
219 |
– |
} |
220 |
– |
if (args_info->input_given && ! override) |
221 |
– |
continue; |
222 |
– |
local_args_info.input_given = 1; |
223 |
– |
args_info->input_given = 1; |
224 |
– |
if (args_info->input_arg) |
225 |
– |
free (args_info->input_arg); /* free previous string */ |
226 |
– |
args_info->input_arg = gengetopt_strdup (optarg); |
227 |
– |
break; |
214 |
|
|
215 |
|
case 'b': /* The step detail for the potential grids - typically a power of 2. */ |
216 |
|
if (local_args_info.bandwidth_given) |
336 |
|
|
337 |
|
if (check_required) |
338 |
|
{ |
353 |
– |
if (! args_info->input_given) |
354 |
– |
{ |
355 |
– |
fprintf (stderr, "%s: '--input' ('-i') option required%s\n", CMDLINE_PARSER_PACKAGE, (additional_error ? additional_error : "")); |
356 |
– |
error = 1; |
357 |
– |
} |
339 |
|
} |
340 |
|
|
341 |
|
if ( error ) |
342 |
|
return (EXIT_FAILURE); |
343 |
|
|
344 |
+ |
if (optind < argc) |
345 |
+ |
{ |
346 |
+ |
int i = 0 ; |
347 |
+ |
|
348 |
+ |
args_info->inputs_num = argc - optind ; |
349 |
+ |
args_info->inputs = |
350 |
+ |
(char **)(malloc ((args_info->inputs_num)*sizeof(char *))) ; |
351 |
+ |
while (optind < argc) |
352 |
+ |
args_info->inputs[ i++ ] = gengetopt_strdup (argv[optind++]) ; |
353 |
+ |
} |
354 |
+ |
|
355 |
|
return 0; |
356 |
|
|
357 |
|
failure: |