/** @file test_conf_parser_cmd.h * @brief The header file for the command line option parser * generated by GNU Gengetopt * http://www.gnu.org/software/gengetopt. * DO NOT modify this file, since it can be overwritten * @author GNU Gengetopt by Lorenzo Bettini */ #ifndef TEST_CONF_PARSER_CMD_H #define TEST_CONF_PARSER_CMD_H /* If we use autoconf. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include /* for FILE */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef TEST_CONF_PARSER_CMD_PARSER_PACKAGE /** @brief the program name (used for printing errors) */ #define TEST_CONF_PARSER_CMD_PARSER_PACKAGE "test_conf_parser" #endif #ifndef TEST_CONF_PARSER_CMD_PARSER_PACKAGE_NAME /** @brief the complete program name (used for help and version) */ #define TEST_CONF_PARSER_CMD_PARSER_PACKAGE_NAME "test_conf_parser" #endif #ifndef TEST_CONF_PARSER_CMD_PARSER_VERSION /** @brief the program version */ #define TEST_CONF_PARSER_CMD_PARSER_VERSION "1.0" #endif /** @brief Where the command line options are stored */ struct my_args_info { const char *help_help; /**< @brief Print help and exit help description. */ const char *version_help; /**< @brief Print version and exit help description. */ char * opta_arg; /**< @brief string a. */ char * opta_orig; /**< @brief string a original value given at command line. */ const char *opta_help; /**< @brief string a help description. */ char * optb_arg; /**< @brief string b. */ char * optb_orig; /**< @brief string b original value given at command line. */ const char *optb_help; /**< @brief string b help description. */ const char *optc_help; /**< @brief string c help description. */ const char *optd_help; /**< @brief string d help description. */ char * string_arg; /**< @brief string option. */ char * string_orig; /**< @brief string option original value given at command line. */ const char *string_help; /**< @brief string option help description. */ int int_arg; /**< @brief int option. */ char * int_orig; /**< @brief int option original value given at command line. */ const char *int_help; /**< @brief int option help description. */ short short_arg; /**< @brief short option. */ char * short_orig; /**< @brief short option original value given at command line. */ const char *short_help; /**< @brief short option help description. */ long long_arg; /**< @brief long option. */ char * long_orig; /**< @brief long option original value given at command line. */ const char *long_help; /**< @brief long option help description. */ float float_arg; /**< @brief float option. */ char * float_orig; /**< @brief float option original value given at command line. */ const char *float_help; /**< @brief float option help description. */ double double_arg; /**< @brief double option. */ char * double_orig; /**< @brief double option original value given at command line. */ const char *double_help; /**< @brief double option help description. */ long double longdouble_arg; /**< @brief longdouble option. */ char * longdouble_orig; /**< @brief longdouble option original value given at command line. */ const char *longdouble_help; /**< @brief longdouble option help description. */ #if defined(HAVE_LONG_LONG) || defined(HAVE_LONG_LONG_INT) long long int longlong_arg; /**< @brief longlong option. */ #else long longlong_arg; /**< @brief longlong option. */ #endif char * longlong_orig; /**< @brief longlong option original value given at command line. */ const char *longlong_help; /**< @brief longlong option help description. */ int flag_flag; /**< @brief flag option (default=on). */ const char *flag_help; /**< @brief flag option help description. */ const char *function_help; /**< @brief function option help description. */ const char *no_short_help; /**< @brief no short option help description. */ char * required_arg; /**< @brief required option. */ char * required_orig; /**< @brief required option original value given at command line. */ const char *required_help; /**< @brief required option help description. */ char * conf_file_arg; /**< @brief config file (default='test_conf.conf'). */ char * conf_file_orig; /**< @brief config file original value given at command line. */ const char *conf_file_help; /**< @brief config file help description. */ char ** multi_string_arg; /**< @brief multiple string option. */ char ** multi_string_orig; /**< @brief multiple string option original value given at command line. */ unsigned int multi_string_min; /**< @brief multiple string option's minimum occurreces */ unsigned int multi_string_max; /**< @brief multiple string option's maximum occurreces */ const char *multi_string_help; /**< @brief multiple string option help description. */ char ** multi_string_def_arg; /**< @brief multiple string option with default (default='this default'). */ char ** multi_string_def_orig; /**< @brief multiple string option with default original value given at command line. */ unsigned int multi_string_def_min; /**< @brief multiple string option with default's minimum occurreces */ unsigned int multi_string_def_max; /**< @brief multiple string option with default's maximum occurreces */ const char *multi_string_def_help; /**< @brief multiple string option with default help description. */ unsigned int noarg_min; /**< @brief multiple option with no arg's minimum occurreces */ unsigned int noarg_max; /**< @brief multiple option with no arg's maximum occurreces */ const char *noarg_help; /**< @brief multiple option with no arg help description. */ unsigned int noarg_noshort_min; /**< @brief multiple option with no arg and no short's minimum occurreces */ unsigned int noarg_noshort_max; /**< @brief multiple option with no arg and no short's maximum occurreces */ const char *noarg_noshort_help; /**< @brief multiple option with no arg and no short help description. */ char * opt_arg_arg; /**< @brief option with optional arg. */ char * opt_arg_orig; /**< @brief option with optional arg original value given at command line. */ const char *opt_arg_help; /**< @brief option with optional arg help description. */ char * file_save_arg; /**< @brief save the passed options into a file. */ char * file_save_orig; /**< @brief save the passed options into a file original value given at command line. */ const char *file_save_help; /**< @brief save the passed options into a file help description. */ unsigned int help_given ; /**< @brief Whether help was given. */ unsigned int version_given ; /**< @brief Whether version was given. */ unsigned int opta_given ; /**< @brief Whether opta was given. */ unsigned int optb_given ; /**< @brief Whether optb was given. */ unsigned int optc_given ; /**< @brief Whether optc was given. */ unsigned int optd_given ; /**< @brief Whether optd was given. */ unsigned int string_given ; /**< @brief Whether string was given. */ unsigned int int_given ; /**< @brief Whether int was given. */ unsigned int short_given ; /**< @brief Whether short was given. */ unsigned int long_given ; /**< @brief Whether long was given. */ unsigned int float_given ; /**< @brief Whether float was given. */ unsigned int double_given ; /**< @brief Whether double was given. */ unsigned int longdouble_given ; /**< @brief Whether longdouble was given. */ unsigned int longlong_given ; /**< @brief Whether longlong was given. */ unsigned int flag_given ; /**< @brief Whether flag was given. */ unsigned int function_given ; /**< @brief Whether function was given. */ unsigned int no_short_given ; /**< @brief Whether no-short was given. */ unsigned int required_given ; /**< @brief Whether required was given. */ unsigned int conf_file_given ; /**< @brief Whether conf-file was given. */ unsigned int multi_string_given ; /**< @brief Whether multi-string was given. */ unsigned int multi_string_def_given ; /**< @brief Whether multi-string-def was given. */ unsigned int noarg_given ; /**< @brief Whether noarg was given. */ unsigned int noarg_noshort_given ; /**< @brief Whether noarg-noshort was given. */ unsigned int opt_arg_given ; /**< @brief Whether opt-arg was given. */ unsigned int file_save_given ; /**< @brief Whether file-save was given. */ char **inputs ; /**< @brief unamed options (options without names) */ unsigned inputs_num ; /**< @brief unamed options number */ int grp1_group_counter; /**< @brief Counter for group grp1 */ int my_grp2_group_counter; /**< @brief Counter for group my_grp2 */ } ; /** @brief The additional parameters to pass to parser functions */ struct test_conf_parser_cmd_parser_params { int override; /**< @brief whether to override possibly already present options (default 0) */ int initialize; /**< @brief whether to initialize the option structure my_args_info (default 1) */ int check_required; /**< @brief whether to check that all required options were provided (default 1) */ int check_ambiguity; /**< @brief whether to check for options already specified in the option structure my_args_info (default 0) */ int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ } ; /** @brief the purpose string of the program */ extern const char *my_args_info_purpose; /** @brief the usage string of the program */ extern const char *my_args_info_usage; /** @brief the description string of the program */ extern const char *my_args_info_description; /** @brief all the lines making the help output */ extern const char *my_args_info_help[]; /** * The command line parser * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser (int argc, char **argv, struct my_args_info *args_info); /** * The command line parser (version with additional parameters - deprecated) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_conf_parser_cmd_parser_ext() instead */ int test_conf_parser_cmd_parser2 (int argc, char **argv, struct my_args_info *args_info, int override, int initialize, int check_required); /** * The command line parser (version with additional parameters) * @param argc the number of command line options * @param argv the command line options * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_ext (int argc, char **argv, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params); /** * Save the contents of the option struct into an already open FILE stream. * @param outfile the stream where to dump options * @param args_info the option struct to dump * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_dump(FILE *outfile, struct my_args_info *args_info); /** * Save the contents of the option struct into a (text) file. * This file can be read by the config file parser (if generated by gengetopt) * @param filename the file where to save * @param args_info the option struct to save * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_file_save(const char *filename, struct my_args_info *args_info); /** * Print the help */ void test_conf_parser_cmd_parser_print_help(void); /** * Print the version */ void test_conf_parser_cmd_parser_print_version(void); /** * Initializes all the fields a test_conf_parser_cmd_parser_params structure * to their default values * @param params the structure to initialize */ void test_conf_parser_cmd_parser_params_init(struct test_conf_parser_cmd_parser_params *params); /** * Allocates dynamically a test_conf_parser_cmd_parser_params structure and initializes * all its fields to their default values * @return the created and initialized test_conf_parser_cmd_parser_params structure */ struct test_conf_parser_cmd_parser_params *test_conf_parser_cmd_parser_params_create(void); /** * Initializes the passed my_args_info structure's fields * (also set default values for options that have a default) * @param args_info the structure to initialize */ void test_conf_parser_cmd_parser_init (struct my_args_info *args_info); /** * Deallocates the string fields of the my_args_info structure * (but does not deallocate the structure itself) * @param args_info the structure to deallocate */ void test_conf_parser_cmd_parser_free (struct my_args_info *args_info); /** * The config file parser (deprecated version) * @param filename the name of the config file * @param args_info the structure where option information will be stored * @param override whether to override possibly already present options * @param initialize whether to initialize the option structure my_args_info * @param check_required whether to check that all required options were provided * @return 0 if everything went fine, NON 0 if an error took place * @deprecated use test_conf_parser_cmd_parser_config_file() instead */ int test_conf_parser_cmd_parser_configfile (const char *filename, struct my_args_info *args_info, int override, int initialize, int check_required); /** * The config file parser * @param filename the name of the config file * @param args_info the structure where option information will be stored * @param params additional parameters for the parser * @return 0 if everything went fine, NON 0 if an error took place */ int test_conf_parser_cmd_parser_config_file (const char *filename, struct my_args_info *args_info, struct test_conf_parser_cmd_parser_params *params); /** * Checks that all the required options were specified * @param args_info the structure to check * @param prog_name the name of the program that will be used to print * possible errors * @return */ int test_conf_parser_cmd_parser_required (struct my_args_info *args_info, const char *prog_name); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* TEST_CONF_PARSER_CMD_H */