Merge branch 'quvi_resolve_#45'
[quvi.git] / src / cmdline.h
blobbba83013af8c326b1041c467bfab611eac4f820f
1 /** @file cmdline.h
2 * @brief The header file for the command line option parser
3 * generated by GNU Gengetopt version 2.22.4
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 */
8 #ifndef CMDLINE_H
9 #define CMDLINE_H
11 /* If we use autoconf. */
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
16 #include <stdio.h> /* for FILE */
18 #ifdef __cplusplus
19 extern "C" {
20 #endif /* __cplusplus */
22 #ifndef CMDLINE_PARSER_PACKAGE
23 /** @brief the program name (used for printing errors) */
24 #define CMDLINE_PARSER_PACKAGE "quvi"
25 #endif
27 #ifndef CMDLINE_PARSER_PACKAGE_NAME
28 /** @brief the complete program name (used for help and version) */
29 #define CMDLINE_PARSER_PACKAGE_NAME "quvi"
30 #endif
32 #ifndef CMDLINE_PARSER_VERSION
33 /** @brief the program version */
34 #define CMDLINE_PARSER_VERSION ""
35 #endif
37 /** @brief Where the command line options are stored */
38 struct gengetopt_args_info
40 const char *help_help; /**< @brief Print help and exit help description. */
41 const char *version_help; /**< @brief Print version and exit help description. */
42 const char *license_help; /**< @brief Print license and exit help description. */
43 const char *support_help; /**< @brief Print supported websites and exit help description. */
44 const char *xml_help; /**< @brief Print details in XML help description. */
45 const char *old_help; /**< @brief Print details in original format help description. */
46 const char *quiet_help; /**< @brief Turn off output to stderr help description. */
47 const char *verbose_libcurl_help; /**< @brief Turn on libcurl verbose mode help description. */
48 char * exec_arg; /**< @brief Invoke arg after parsing. */
49 char * exec_orig; /**< @brief Invoke arg after parsing original value given at command line. */
50 const char *exec_help; /**< @brief Invoke arg after parsing help description. */
51 const char *no_resolve_help; /**< @brief Do not resolve redirections help description. */
52 const char *no_verify_help; /**< @brief Do not verify media URL help description. */
53 const char *category_http_help; /**< @brief Category HTTP website scripts help description. */
54 const char *category_mms_help; /**< @brief Category MMS website scripts help description. */
55 const char *category_rtsp_help; /**< @brief Category RTSP website scripts help description. */
56 const char *category_rtmp_help; /**< @brief Category RTMP website scripts help description. */
57 const char *category_all_help; /**< @brief All website script categories help description. */
58 char * format_arg; /**< @brief Video format to query (default='default'). */
59 char * format_orig; /**< @brief Video format to query original value given at command line. */
60 const char *format_help; /**< @brief Video format to query help description. */
61 char * agent_arg; /**< @brief Identify as arg (default='Mozilla/5.0'). */
62 char * agent_orig; /**< @brief Identify as arg original value given at command line. */
63 const char *agent_help; /**< @brief Identify as arg help description. */
64 char * proxy_arg; /**< @brief Use proxy for HTTP connections. */
65 char * proxy_orig; /**< @brief Use proxy for HTTP connections original value given at command line. */
66 const char *proxy_help; /**< @brief Use proxy for HTTP connections help description. */
67 const char *no_proxy_help; /**< @brief Disable use of HTTP proxy help description. */
68 int connect_timeout_arg; /**< @brief Seconds connecting allowed to take (default='30'). */
69 char * connect_timeout_orig; /**< @brief Seconds connecting allowed to take original value given at command line. */
70 const char *connect_timeout_help; /**< @brief Seconds connecting allowed to take help description. */
72 unsigned int help_given ; /**< @brief Whether help was given. */
73 unsigned int version_given ; /**< @brief Whether version was given. */
74 unsigned int license_given ; /**< @brief Whether license was given. */
75 unsigned int support_given ; /**< @brief Whether support was given. */
76 unsigned int xml_given ; /**< @brief Whether xml was given. */
77 unsigned int old_given ; /**< @brief Whether old was given. */
78 unsigned int quiet_given ; /**< @brief Whether quiet was given. */
79 unsigned int verbose_libcurl_given ; /**< @brief Whether verbose-libcurl was given. */
80 unsigned int exec_given ; /**< @brief Whether exec was given. */
81 unsigned int no_resolve_given ; /**< @brief Whether no-resolve was given. */
82 unsigned int no_verify_given ; /**< @brief Whether no-verify was given. */
83 unsigned int category_http_given ; /**< @brief Whether category-http was given. */
84 unsigned int category_mms_given ; /**< @brief Whether category-mms was given. */
85 unsigned int category_rtsp_given ; /**< @brief Whether category-rtsp was given. */
86 unsigned int category_rtmp_given ; /**< @brief Whether category-rtmp was given. */
87 unsigned int category_all_given ; /**< @brief Whether category-all was given. */
88 unsigned int format_given ; /**< @brief Whether format was given. */
89 unsigned int agent_given ; /**< @brief Whether agent was given. */
90 unsigned int proxy_given ; /**< @brief Whether proxy was given. */
91 unsigned int no_proxy_given ; /**< @brief Whether no-proxy was given. */
92 unsigned int connect_timeout_given ; /**< @brief Whether connect-timeout was given. */
94 char **inputs ; /**< @brief unamed options (options without names) */
95 unsigned inputs_num ; /**< @brief unamed options number */
96 } ;
98 /** @brief The additional parameters to pass to parser functions */
99 struct cmdline_parser_params
101 int override; /**< @brief whether to override possibly already present options (default 0) */
102 int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
103 int check_required; /**< @brief whether to check that all required options were provided (default 1) */
104 int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
105 int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
108 /** @brief the purpose string of the program */
109 extern const char *gengetopt_args_info_purpose;
110 /** @brief the usage string of the program */
111 extern const char *gengetopt_args_info_usage;
112 /** @brief all the lines making the help output */
113 extern const char *gengetopt_args_info_help[];
116 * The command line parser
117 * @param argc the number of command line options
118 * @param argv the command line options
119 * @param args_info the structure where option information will be stored
120 * @return 0 if everything went fine, NON 0 if an error took place
122 int cmdline_parser (int argc, char **argv,
123 struct gengetopt_args_info *args_info);
126 * The command line parser (version with additional parameters - deprecated)
127 * @param argc the number of command line options
128 * @param argv the command line options
129 * @param args_info the structure where option information will be stored
130 * @param override whether to override possibly already present options
131 * @param initialize whether to initialize the option structure my_args_info
132 * @param check_required whether to check that all required options were provided
133 * @return 0 if everything went fine, NON 0 if an error took place
134 * @deprecated use cmdline_parser_ext() instead
136 int cmdline_parser2 (int argc, char **argv,
137 struct gengetopt_args_info *args_info,
138 int override, int initialize, int check_required);
141 * The command line parser (version with additional parameters)
142 * @param argc the number of command line options
143 * @param argv the command line options
144 * @param args_info the structure where option information will be stored
145 * @param params additional parameters for the parser
146 * @return 0 if everything went fine, NON 0 if an error took place
148 int cmdline_parser_ext (int argc, char **argv,
149 struct gengetopt_args_info *args_info,
150 struct cmdline_parser_params *params);
153 * Save the contents of the option struct into an already open FILE stream.
154 * @param outfile the stream where to dump options
155 * @param args_info the option struct to dump
156 * @return 0 if everything went fine, NON 0 if an error took place
158 int cmdline_parser_dump(FILE *outfile,
159 struct gengetopt_args_info *args_info);
162 * Save the contents of the option struct into a (text) file.
163 * This file can be read by the config file parser (if generated by gengetopt)
164 * @param filename the file where to save
165 * @param args_info the option struct to save
166 * @return 0 if everything went fine, NON 0 if an error took place
168 int cmdline_parser_file_save(const char *filename,
169 struct gengetopt_args_info *args_info);
172 * Print the help
174 void cmdline_parser_print_help(void);
176 * Print the version
178 void cmdline_parser_print_version(void);
181 * Initializes all the fields a cmdline_parser_params structure
182 * to their default values
183 * @param params the structure to initialize
185 void cmdline_parser_params_init(struct cmdline_parser_params *params);
188 * Allocates dynamically a cmdline_parser_params structure and initializes
189 * all its fields to their default values
190 * @return the created and initialized cmdline_parser_params structure
192 struct cmdline_parser_params *cmdline_parser_params_create(void);
195 * Initializes the passed gengetopt_args_info structure's fields
196 * (also set default values for options that have a default)
197 * @param args_info the structure to initialize
199 void cmdline_parser_init (struct gengetopt_args_info *args_info);
201 * Deallocates the string fields of the gengetopt_args_info structure
202 * (but does not deallocate the structure itself)
203 * @param args_info the structure to deallocate
205 void cmdline_parser_free (struct gengetopt_args_info *args_info);
208 * The config file parser (deprecated version)
209 * @param filename the name of the config file
210 * @param args_info the structure where option information will be stored
211 * @param override whether to override possibly already present options
212 * @param initialize whether to initialize the option structure my_args_info
213 * @param check_required whether to check that all required options were provided
214 * @return 0 if everything went fine, NON 0 if an error took place
215 * @deprecated use cmdline_parser_config_file() instead
217 int cmdline_parser_configfile (const char *filename,
218 struct gengetopt_args_info *args_info,
219 int override, int initialize, int check_required);
222 * The config file parser
223 * @param filename the name of the config file
224 * @param args_info the structure where option information will be stored
225 * @param params additional parameters for the parser
226 * @return 0 if everything went fine, NON 0 if an error took place
228 int cmdline_parser_config_file (const char *filename,
229 struct gengetopt_args_info *args_info,
230 struct cmdline_parser_params *params);
233 * Checks that all the required options were specified
234 * @param args_info the structure to check
235 * @param prog_name the name of the program that will be used to print
236 * possible errors
237 * @return
239 int cmdline_parser_required (struct gengetopt_args_info *args_info,
240 const char *prog_name);
243 #ifdef __cplusplus
245 #endif /* __cplusplus */
246 #endif /* CMDLINE_H */