1 |
/** @file recenterCmd.h |
2 |
* @brief The header file for the command line option parser |
3 |
* generated by GNU Gengetopt version 2.22.6 |
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 */ |
7 |
|
8 |
#ifndef RECENTERCMD_H |
9 |
#define RECENTERCMD_H |
10 |
|
11 |
/* If we use autoconf. */ |
12 |
#ifdef HAVE_CONFIG_H |
13 |
#include "config.h" |
14 |
#endif |
15 |
|
16 |
#include <stdio.h> /* for FILE */ |
17 |
|
18 |
#ifdef __cplusplus |
19 |
extern "C" { |
20 |
#endif /* __cplusplus */ |
21 |
|
22 |
#ifndef CMDLINE_PARSER_PACKAGE |
23 |
/** @brief the program name (used for printing errors) */ |
24 |
#define CMDLINE_PARSER_PACKAGE "recenter" |
25 |
#endif |
26 |
|
27 |
#ifndef CMDLINE_PARSER_PACKAGE_NAME |
28 |
/** @brief the complete program name (used for help and version) */ |
29 |
#define CMDLINE_PARSER_PACKAGE_NAME "recenter" |
30 |
#endif |
31 |
|
32 |
#ifndef CMDLINE_PARSER_VERSION |
33 |
/** @brief the program version */ |
34 |
#define CMDLINE_PARSER_VERSION "1.0" |
35 |
#endif |
36 |
|
37 |
/** @brief Where the command line options are stored */ |
38 |
struct gengetopt_args_info |
39 |
{ |
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 |
char * output_arg; /**< @brief Output file name. */ |
43 |
char * output_orig; /**< @brief Output file name original value given at command line. */ |
44 |
const char *output_help; /**< @brief Output file name help description. */ |
45 |
|
46 |
unsigned int help_given ; /**< @brief Whether help was given. */ |
47 |
unsigned int version_given ; /**< @brief Whether version was given. */ |
48 |
unsigned int output_given ; /**< @brief Whether output was given. */ |
49 |
|
50 |
char **inputs ; /**< @brief unamed options (options without names) */ |
51 |
unsigned inputs_num ; /**< @brief unamed options number */ |
52 |
} ; |
53 |
|
54 |
/** @brief The additional parameters to pass to parser functions */ |
55 |
struct cmdline_parser_params |
56 |
{ |
57 |
int override; /**< @brief whether to override possibly already present options (default 0) */ |
58 |
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */ |
59 |
int check_required; /**< @brief whether to check that all required options were provided (default 1) */ |
60 |
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */ |
61 |
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */ |
62 |
} ; |
63 |
|
64 |
/** @brief the purpose string of the program */ |
65 |
extern const char *gengetopt_args_info_purpose; |
66 |
/** @brief the usage string of the program */ |
67 |
extern const char *gengetopt_args_info_usage; |
68 |
/** @brief the description string of the program */ |
69 |
extern const char *gengetopt_args_info_description; |
70 |
/** @brief all the lines making the help output */ |
71 |
extern const char *gengetopt_args_info_help[]; |
72 |
|
73 |
/** |
74 |
* The command line parser |
75 |
* @param argc the number of command line options |
76 |
* @param argv the command line options |
77 |
* @param args_info the structure where option information will be stored |
78 |
* @return 0 if everything went fine, NON 0 if an error took place |
79 |
*/ |
80 |
int cmdline_parser (int argc, char **argv, |
81 |
struct gengetopt_args_info *args_info); |
82 |
|
83 |
/** |
84 |
* The command line parser (version with additional parameters - deprecated) |
85 |
* @param argc the number of command line options |
86 |
* @param argv the command line options |
87 |
* @param args_info the structure where option information will be stored |
88 |
* @param override whether to override possibly already present options |
89 |
* @param initialize whether to initialize the option structure my_args_info |
90 |
* @param check_required whether to check that all required options were provided |
91 |
* @return 0 if everything went fine, NON 0 if an error took place |
92 |
* @deprecated use cmdline_parser_ext() instead |
93 |
*/ |
94 |
int cmdline_parser2 (int argc, char **argv, |
95 |
struct gengetopt_args_info *args_info, |
96 |
int override, int initialize, int check_required); |
97 |
|
98 |
/** |
99 |
* The command line parser (version with additional parameters) |
100 |
* @param argc the number of command line options |
101 |
* @param argv the command line options |
102 |
* @param args_info the structure where option information will be stored |
103 |
* @param params additional parameters for the parser |
104 |
* @return 0 if everything went fine, NON 0 if an error took place |
105 |
*/ |
106 |
int cmdline_parser_ext (int argc, char **argv, |
107 |
struct gengetopt_args_info *args_info, |
108 |
struct cmdline_parser_params *params); |
109 |
|
110 |
/** |
111 |
* Save the contents of the option struct into an already open FILE stream. |
112 |
* @param outfile the stream where to dump options |
113 |
* @param args_info the option struct to dump |
114 |
* @return 0 if everything went fine, NON 0 if an error took place |
115 |
*/ |
116 |
int cmdline_parser_dump(FILE *outfile, |
117 |
struct gengetopt_args_info *args_info); |
118 |
|
119 |
/** |
120 |
* Save the contents of the option struct into a (text) file. |
121 |
* This file can be read by the config file parser (if generated by gengetopt) |
122 |
* @param filename the file where to save |
123 |
* @param args_info the option struct to save |
124 |
* @return 0 if everything went fine, NON 0 if an error took place |
125 |
*/ |
126 |
int cmdline_parser_file_save(const char *filename, |
127 |
struct gengetopt_args_info *args_info); |
128 |
|
129 |
/** |
130 |
* Print the help |
131 |
*/ |
132 |
void cmdline_parser_print_help(void); |
133 |
/** |
134 |
* Print the version |
135 |
*/ |
136 |
void cmdline_parser_print_version(void); |
137 |
|
138 |
/** |
139 |
* Initializes all the fields a cmdline_parser_params structure |
140 |
* to their default values |
141 |
* @param params the structure to initialize |
142 |
*/ |
143 |
void cmdline_parser_params_init(struct cmdline_parser_params *params); |
144 |
|
145 |
/** |
146 |
* Allocates dynamically a cmdline_parser_params structure and initializes |
147 |
* all its fields to their default values |
148 |
* @return the created and initialized cmdline_parser_params structure |
149 |
*/ |
150 |
struct cmdline_parser_params *cmdline_parser_params_create(void); |
151 |
|
152 |
/** |
153 |
* Initializes the passed gengetopt_args_info structure's fields |
154 |
* (also set default values for options that have a default) |
155 |
* @param args_info the structure to initialize |
156 |
*/ |
157 |
void cmdline_parser_init (struct gengetopt_args_info *args_info); |
158 |
/** |
159 |
* Deallocates the string fields of the gengetopt_args_info structure |
160 |
* (but does not deallocate the structure itself) |
161 |
* @param args_info the structure to deallocate |
162 |
*/ |
163 |
void cmdline_parser_free (struct gengetopt_args_info *args_info); |
164 |
|
165 |
/** |
166 |
* Checks that all the required options were specified |
167 |
* @param args_info the structure to check |
168 |
* @param prog_name the name of the program that will be used to print |
169 |
* possible errors |
170 |
* @return |
171 |
*/ |
172 |
int cmdline_parser_required (struct gengetopt_args_info *args_info, |
173 |
const char *prog_name); |
174 |
|
175 |
|
176 |
#ifdef __cplusplus |
177 |
} |
178 |
#endif /* __cplusplus */ |
179 |
#endif /* RECENTERCMD_H */ |