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 -u -F thermalizerCmd |
4 |
> |
gengetopt -F thermalizerCmd -u |
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 "thermalizerCmd.h" |
31 |
|
|
32 |
|
const char *gengetopt_args_info_purpose = "Resamples the velocities for all the integrable objects in an OpenMD file from \na Maxwell-Boltzmann distribution."; |
54 |
|
void clear_args (struct gengetopt_args_info *args_info); |
55 |
|
|
56 |
|
static int |
57 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
57 |
> |
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info, |
58 |
|
struct cmdline_parser_params *params, const char *additional_error); |
59 |
|
|
60 |
|
static int |
75 |
|
static |
76 |
|
void clear_args (struct gengetopt_args_info *args_info) |
77 |
|
{ |
78 |
+ |
FIX_UNUSED (args_info); |
79 |
|
args_info->output_arg = NULL; |
80 |
|
args_info->output_orig = NULL; |
81 |
|
args_info->temperature_orig = NULL; |
97 |
|
void |
98 |
|
cmdline_parser_print_version (void) |
99 |
|
{ |
100 |
< |
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); |
100 |
> |
printf ("%s %s\n", |
101 |
> |
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE), |
102 |
> |
CMDLINE_PARSER_VERSION); |
103 |
|
} |
104 |
|
|
105 |
|
static void print_help_common(void) { |
114 |
|
printf("\n"); |
115 |
|
|
116 |
|
if (strlen(gengetopt_args_info_description) > 0) |
117 |
< |
printf("%s\n", gengetopt_args_info_description); |
117 |
> |
printf("%s\n\n", gengetopt_args_info_description); |
118 |
|
} |
119 |
|
|
120 |
|
void |
133 |
|
clear_args (args_info); |
134 |
|
init_args_info (args_info); |
135 |
|
|
136 |
< |
args_info->inputs = NULL; |
136 |
> |
args_info->inputs = 0; |
137 |
|
args_info->inputs_num = 0; |
138 |
|
} |
139 |
|
|
190 |
|
|
191 |
|
|
192 |
|
static void |
193 |
< |
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) |
193 |
> |
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[]) |
194 |
|
{ |
195 |
+ |
FIX_UNUSED (values); |
196 |
|
if (arg) { |
197 |
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg); |
198 |
|
} else { |
256 |
|
char * |
257 |
|
gengetopt_strdup (const char *s) |
258 |
|
{ |
259 |
< |
char *result = NULL; |
259 |
> |
char *result = 0; |
260 |
|
if (!s) |
261 |
|
return result; |
262 |
|
|
268 |
|
} |
269 |
|
|
270 |
|
int |
271 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
271 |
> |
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info) |
272 |
|
{ |
273 |
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
274 |
|
} |
275 |
|
|
276 |
|
int |
277 |
< |
cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
277 |
> |
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info, |
278 |
|
struct cmdline_parser_params *params) |
279 |
|
{ |
280 |
|
int result; |
281 |
< |
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); |
281 |
> |
result = cmdline_parser_internal (argc, argv, args_info, params, 0); |
282 |
|
|
283 |
|
if (result == EXIT_FAILURE) |
284 |
|
{ |
290 |
|
} |
291 |
|
|
292 |
|
int |
293 |
< |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
293 |
> |
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
294 |
|
{ |
295 |
|
int result; |
296 |
|
struct cmdline_parser_params params; |
301 |
|
params.check_ambiguity = 0; |
302 |
|
params.print_errors = 1; |
303 |
|
|
304 |
< |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, NULL); |
304 |
> |
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0); |
305 |
|
|
306 |
|
if (result == EXIT_FAILURE) |
307 |
|
{ |
317 |
|
{ |
318 |
|
int result = EXIT_SUCCESS; |
319 |
|
|
320 |
< |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
320 |
> |
if (cmdline_parser_required2(args_info, prog_name, 0) > 0) |
321 |
|
result = EXIT_FAILURE; |
322 |
|
|
323 |
|
if (result == EXIT_FAILURE) |
333 |
|
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
334 |
|
{ |
335 |
|
int error = 0; |
336 |
+ |
FIX_UNUSED (additional_error); |
337 |
|
|
338 |
|
/* checks for required options */ |
339 |
|
if (! args_info->output_given) |
378 |
|
static |
379 |
|
int update_arg(void *field, char **orig_field, |
380 |
|
unsigned int *field_given, unsigned int *prev_given, |
381 |
< |
char *value, char *possible_values[], const char *default_value, |
381 |
> |
char *value, const char *possible_values[], |
382 |
> |
const char *default_value, |
383 |
|
cmdline_parser_arg_type arg_type, |
384 |
|
int check_ambiguity, int override, |
385 |
|
int no_free, int multiple_option, |
390 |
|
const char *val = value; |
391 |
|
int found; |
392 |
|
char **string_field; |
393 |
+ |
FIX_UNUSED (field); |
394 |
|
|
395 |
|
stop_char = 0; |
396 |
|
found = 0; |
408 |
|
return 1; /* failure */ |
409 |
|
} |
410 |
|
|
411 |
+ |
FIX_UNUSED (default_value); |
412 |
|
|
413 |
|
if (field_given && *field_given && ! override) |
414 |
|
return 0; |
468 |
|
|
469 |
|
|
470 |
|
int |
471 |
< |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, |
471 |
> |
cmdline_parser_internal ( |
472 |
> |
int argc, char **argv, struct gengetopt_args_info *args_info, |
473 |
|
struct cmdline_parser_params *params, const char *additional_error) |
474 |
|
{ |
475 |
|
int c; /* Character of the parsed option. */ |
508 |
|
{ "version", 0, NULL, 'V' }, |
509 |
|
{ "output", 1, NULL, 'o' }, |
510 |
|
{ "temperature", 1, NULL, 't' }, |
511 |
< |
{ NULL, 0, NULL, 0 } |
511 |
> |
{ 0, 0, 0, 0 } |
512 |
|
}; |
513 |
|
|
514 |
|
c = getopt_long (argc, argv, "hVo:t:", long_options, &option_index); |