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. */
50 int debug_arg; /**< @brief Debug messages level (default='0'). */
51 char * debug_orig; /**< @brief Debug messages level original value given at command line. */
52 const char *debug_help; /**< @brief Debug messages level help description. */
54 unsigned int help_given ; /**< @brief Whether help was given. */
55 unsigned int version_given ; /**< @brief Whether version was given. */
56 unsigned int print_given ; /**< @brief Whether print was given. */
57 unsigned int file_given ; /**< @brief Whether file was given. */
58 unsigned int dir_given ; /**< @brief Whether dir was given. */
59 unsigned int recurse_given ; /**< @brief Whether recurse was given. */
60 unsigned int verbose_given ; /**< @brief Whether verbose was given. */
61 unsigned int debug_given ; /**< @brief Whether debug was given. */
63 char **inputs ; /**< @brief unamed options (options without names) */
64 unsigned inputs_num ; /**< @brief unamed options number */
67 /** @brief The additional parameters to pass to parser functions */
68 struct cmdline_parser_params
70 int override; /**< @brief whether to override possibly already present options (default 0) */
71 int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
72 int check_required; /**< @brief whether to check that all required options were provided (default 1) */
73 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
74 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
77 /** @brief the purpose string of the program */
78 extern const char *gengetopt_args_info_purpose;
79 /** @brief the usage string of the program */
80 extern const char *gengetopt_args_info_usage;
81 /** @brief all the lines making the help output */
82 extern const char *gengetopt_args_info_help[];
85 * The command line parser
86 * @param argc the number of command line options
87 * @param argv the command line options
88 * @param args_info the structure where option information will be stored
89 * @return 0 if everything went fine, NON 0 if an error took place
91 int cmdline_parser (int argc, char * const *argv,
92 struct gengetopt_args_info *args_info);
95 * The command line parser (version with additional parameters - deprecated)
96 * @param argc the number of command line options
97 * @param argv the command line options
98 * @param args_info the structure where option information will be stored
99 * @param override whether to override possibly already present options
100 * @param initialize whether to initialize the option structure my_args_info
101 * @param check_required whether to check that all required options were provided
102 * @return 0 if everything went fine, NON 0 if an error took place
103 * @deprecated use cmdline_parser_ext() instead
105 int cmdline_parser2 (int argc, char * const *argv,
106 struct gengetopt_args_info *args_info,
107 int override, int initialize, int check_required);
110 * The command line parser (version with additional parameters)
111 * @param argc the number of command line options
112 * @param argv the command line options
113 * @param args_info the structure where option information will be stored
114 * @param params additional parameters for the parser
115 * @return 0 if everything went fine, NON 0 if an error took place
117 int cmdline_parser_ext (int argc, char * const *argv,
118 struct gengetopt_args_info *args_info,
119 struct cmdline_parser_params *params);
122 * Save the contents of the option struct into an already open FILE stream.
123 * @param outfile the stream where to dump options
124 * @param args_info the option struct to dump
125 * @return 0 if everything went fine, NON 0 if an error took place
127 int cmdline_parser_dump(FILE *outfile,
128 struct gengetopt_args_info *args_info);
131 * Save the contents of the option struct into a (text) file.
132 * This file can be read by the config file parser (if generated by gengetopt)
133 * @param filename the file where to save
134 * @param args_info the option struct to save
135 * @return 0 if everything went fine, NON 0 if an error took place
137 int cmdline_parser_file_save(const char *filename,
138 struct gengetopt_args_info *args_info);
143 void cmdline_parser_print_help(void);
147 void cmdline_parser_print_version(void);
150 * Initializes all the fields a cmdline_parser_params structure
151 * to their default values
152 * @param params the structure to initialize
154 void cmdline_parser_params_init(struct cmdline_parser_params *params);
157 * Allocates dynamically a cmdline_parser_params structure and initializes
158 * all its fields to their default values
159 * @return the created and initialized cmdline_parser_params structure
161 struct cmdline_parser_params *cmdline_parser_params_create(void);
164 * Initializes the passed gengetopt_args_info structure's fields
165 * (also set default values for options that have a default)
166 * @param args_info the structure to initialize
168 void cmdline_parser_init (struct gengetopt_args_info *args_info);
170 * Deallocates the string fields of the gengetopt_args_info structure
171 * (but does not deallocate the structure itself)
172 * @param args_info the structure to deallocate
174 void cmdline_parser_free (struct gengetopt_args_info *args_info);
177 * The config file parser (deprecated version)
178 * @param filename the name of the config file
179 * @param args_info the structure where option information will be stored
180 * @param override whether to override possibly already present options
181 * @param initialize whether to initialize the option structure my_args_info
182 * @param check_required whether to check that all required options were provided
183 * @return 0 if everything went fine, NON 0 if an error took place
184 * @deprecated use cmdline_parser_config_file() instead
186 int cmdline_parser_configfile (char * const filename,
187 struct gengetopt_args_info *args_info,
188 int override, int initialize, int check_required);
191 * The config file parser
192 * @param filename the name of the config file
193 * @param args_info the structure where option information will be stored
194 * @param params additional parameters for the parser
195 * @return 0 if everything went fine, NON 0 if an error took place
197 int cmdline_parser_config_file (char * const filename,
198 struct gengetopt_args_info *args_info,
199 struct cmdline_parser_params *params);
202 * Checks that all the required options were specified
203 * @param args_info the structure to check
204 * @param prog_name the name of the program that will be used to print
208 int cmdline_parser_required (struct gengetopt_args_info *args_info,
209 const char *prog_name);
214 #endif /* __cplusplus */
215 #endif /* GIMMICK_GGO_H */