1 /** @file gimmick_ggo.h
2 * @brief The header file for the command line option parser
3 * generated by GNU Gengetopt version 2.22
4 * http://www.gnu.org/software/gengetopt.
5 * DO NOT modify this file, since it can be overwritten
6 * @author GNU Gengetopt by Lorenzo Bettini */
11 /* If we use autoconf. */
16 #include <stdio.h> /* for FILE */
20 #endif /* __cplusplus */
22 #ifndef CMDLINE_PARSER_PACKAGE
23 /** @brief the program name */
24 #define CMDLINE_PARSER_PACKAGE "gimmick"
27 #ifndef CMDLINE_PARSER_VERSION
28 /** @brief the program version */
29 #define CMDLINE_PARSER_VERSION "0.1.0"
32 /** @brief Where the command line options are stored */
33 struct gengetopt_args_info
35 const char *help_help; /**< @brief Print help and exit help description. */
36 const char *version_help; /**< @brief Print version and exit help description. */
37 int print_flag; /**< @brief Prints the local database tree (default=off). */
38 const char *print_help; /**< @brief Prints the local database tree help description. */
39 char * file_arg; /**< @brief Adds the file to local database. */
40 char * file_orig; /**< @brief Adds the file to local database original value given at command line. */
41 const char *file_help; /**< @brief Adds the file to local database help description. */
42 char * dir_arg; /**< @brief Adds the directory to local database. */
43 char * dir_orig; /**< @brief Adds the directory to local database original value given at command line. */
44 const char *dir_help; /**< @brief Adds the directory to local database help description. */
45 int recurse_flag; /**< @brief Recurse into sub-directories (default=off). */
46 const char *recurse_help; /**< @brief Recurse into sub-directories help description. */
47 int verbose_arg; /**< @brief Verbosity level (default='1'). */
48 char * verbose_orig; /**< @brief Verbosity level original value given at command line. */
49 const char *verbose_help; /**< @brief Verbosity level help description. */
51 unsigned int help_given ; /**< @brief Whether help was given. */
52 unsigned int version_given ; /**< @brief Whether version was given. */
53 unsigned int print_given ; /**< @brief Whether print was given. */
54 unsigned int file_given ; /**< @brief Whether file was given. */
55 unsigned int dir_given ; /**< @brief Whether dir was given. */
56 unsigned int recurse_given ; /**< @brief Whether recurse was given. */
57 unsigned int verbose_given ; /**< @brief Whether verbose was given. */
59 char **inputs ; /**< @brief unamed options (options without names) */
60 unsigned inputs_num ; /**< @brief unamed options number */
63 /** @brief The additional parameters to pass to parser functions */
64 struct cmdline_parser_params
66 int override; /**< @brief whether to override possibly already present options (default 0) */
67 int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
68 int check_required; /**< @brief whether to check that all required options were provided (default 1) */
69 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
70 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
73 /** @brief the purpose string of the program */
74 extern const char *gengetopt_args_info_purpose;
75 /** @brief the usage string of the program */
76 extern const char *gengetopt_args_info_usage;
77 /** @brief all the lines making the help output */
78 extern const char *gengetopt_args_info_help[];
81 * The command line parser
82 * @param argc the number of command line options
83 * @param argv the command line options
84 * @param args_info the structure where option information will be stored
85 * @return 0 if everything went fine, NON 0 if an error took place
87 int cmdline_parser (int argc, char * const *argv,
88 struct gengetopt_args_info *args_info);
91 * The command line parser (version with additional parameters - deprecated)
92 * @param argc the number of command line options
93 * @param argv the command line options
94 * @param args_info the structure where option information will be stored
95 * @param override whether to override possibly already present options
96 * @param initialize whether to initialize the option structure my_args_info
97 * @param check_required whether to check that all required options were provided
98 * @return 0 if everything went fine, NON 0 if an error took place
99 * @deprecated use cmdline_parser_ext() instead
101 int cmdline_parser2 (int argc, char * const *argv,
102 struct gengetopt_args_info *args_info,
103 int override, int initialize, int check_required);
106 * The command line parser (version with additional parameters)
107 * @param argc the number of command line options
108 * @param argv the command line options
109 * @param args_info the structure where option information will be stored
110 * @param params additional parameters for the parser
111 * @return 0 if everything went fine, NON 0 if an error took place
113 int cmdline_parser_ext (int argc, char * const *argv,
114 struct gengetopt_args_info *args_info,
115 struct cmdline_parser_params *params);
118 * Save the contents of the option struct into an already open FILE stream.
119 * @param outfile the stream where to dump options
120 * @param args_info the option struct to dump
121 * @return 0 if everything went fine, NON 0 if an error took place
123 int cmdline_parser_dump(FILE *outfile,
124 struct gengetopt_args_info *args_info);
127 * Save the contents of the option struct into a (text) file.
128 * This file can be read by the config file parser (if generated by gengetopt)
129 * @param filename the file where to save
130 * @param args_info the option struct to save
131 * @return 0 if everything went fine, NON 0 if an error took place
133 int cmdline_parser_file_save(const char *filename,
134 struct gengetopt_args_info *args_info);
139 void cmdline_parser_print_help(void);
143 void cmdline_parser_print_version(void);
146 * Initializes all the fields a cmdline_parser_params structure
147 * to their default values
148 * @param params the structure to initialize
150 void cmdline_parser_params_init(struct cmdline_parser_params *params);
153 * Allocates dynamically a cmdline_parser_params structure and initializes
154 * all its fields to their default values
155 * @return the created and initialized cmdline_parser_params structure
157 struct cmdline_parser_params *cmdline_parser_params_create(void);
160 * Initializes the passed gengetopt_args_info structure's fields
161 * (also set default values for options that have a default)
162 * @param args_info the structure to initialize
164 void cmdline_parser_init (struct gengetopt_args_info *args_info);
166 * Deallocates the string fields of the gengetopt_args_info structure
167 * (but does not deallocate the structure itself)
168 * @param args_info the structure to deallocate
170 void cmdline_parser_free (struct gengetopt_args_info *args_info);
173 * The config file parser (deprecated version)
174 * @param filename the name of the config file
175 * @param args_info the structure where option information will be stored
176 * @param override whether to override possibly already present options
177 * @param initialize whether to initialize the option structure my_args_info
178 * @param check_required whether to check that all required options were provided
179 * @return 0 if everything went fine, NON 0 if an error took place
180 * @deprecated use cmdline_parser_config_file() instead
182 int cmdline_parser_configfile (char * const filename,
183 struct gengetopt_args_info *args_info,
184 int override, int initialize, int check_required);
187 * The config file parser
188 * @param filename the name of the config file
189 * @param args_info the structure where option information will be stored
190 * @param params additional parameters for the parser
191 * @return 0 if everything went fine, NON 0 if an error took place
193 int cmdline_parser_config_file (char * const filename,
194 struct gengetopt_args_info *args_info,
195 struct cmdline_parser_params *params);
198 * Checks that all the required options were specified
199 * @param args_info the structure to check
200 * @param prog_name the name of the program that will be used to print
204 int cmdline_parser_required (struct gengetopt_args_info *args_info,
205 const char *prog_name);
210 #endif /* __cplusplus */
211 #endif /* GIMMICK_GGO_H */