static int print_complete_help_and_die(void)
{
const char **line;
- select_cmdline_parser_init(&select_conf);
printf("%s-%s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
printf("%s\n\n", gengetopt_args_info_purpose);
printf("Interactive commands:\n");
print_interactive_help();
+ cmdline_parser_free(&conf);
+ select_cmdline_parser_free(&select_conf);
exit(EXIT_FAILURE);
}
{
int ret;
struct cmdline_parser_params params = {
- .override = 0,
+ .override = 1,
.initialize = 1,
.check_required = 0,
.check_ambiguity = 0,
.print_errors = 0
};
+ select_cmdline_parser_init(&select_conf);
+ cmdline_parser_init(&conf);
/* ignore errors and print complete help if --help was given */
cmdline_parser_ext(argc, argv, &conf, ¶ms);
if (conf.help_given || conf.detailed_help_given)
print_complete_help_and_die();
+ cmdline_parser_free(&conf);
params.check_required = 1;
params.check_ambiguity = 1;
params.print_errors = 1;
ERROR_LOG("%s\n", adu_strerror(-ret));
return -EXIT_FAILURE;
}
+ cmdline_parser_free(&conf);
+ select_cmdline_parser_free(&select_conf);
return EXIT_SUCCESS;
}
.print_errors = 1
};
- select_cmdline_parser_init(&select_conf);
ret = parse_select_options(conf.select_options_arg, ¶ms,
&admissible_uids, &fi);
- if (ret <= 0) /* do not run query if help was given */
- return ret;
- ret = run_select_query(admissible_uids, fi);
- free_format_info(fi);
+ if (ret > 0) {
+ ret = run_select_query(admissible_uids, fi);
+ free_format_info(fi);
+ }
+ select_cmdline_parser_free(&select_conf);
return ret;
}