1 |
kstocke1 |
1857 |
/** @file recenterCmd.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 */ |
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 all the lines making the help output */ |
69 |
|
|
extern const char *gengetopt_args_info_help[]; |
70 |
|
|
|
71 |
|
|
/** |
72 |
|
|
* The command line parser |
73 |
|
|
* @param argc the number of command line options |
74 |
|
|
* @param argv the command line options |
75 |
|
|
* @param args_info the structure where option information will be stored |
76 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
77 |
|
|
*/ |
78 |
|
|
int cmdline_parser (int argc, char **argv, |
79 |
|
|
struct gengetopt_args_info *args_info); |
80 |
|
|
|
81 |
|
|
/** |
82 |
|
|
* The command line parser (version with additional parameters - deprecated) |
83 |
|
|
* @param argc the number of command line options |
84 |
|
|
* @param argv the command line options |
85 |
|
|
* @param args_info the structure where option information will be stored |
86 |
|
|
* @param override whether to override possibly already present options |
87 |
|
|
* @param initialize whether to initialize the option structure my_args_info |
88 |
|
|
* @param check_required whether to check that all required options were provided |
89 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
90 |
|
|
* @deprecated use cmdline_parser_ext() instead |
91 |
|
|
*/ |
92 |
|
|
int cmdline_parser2 (int argc, char **argv, |
93 |
|
|
struct gengetopt_args_info *args_info, |
94 |
|
|
int override, int initialize, int check_required); |
95 |
|
|
|
96 |
|
|
/** |
97 |
|
|
* The command line parser (version with additional parameters) |
98 |
|
|
* @param argc the number of command line options |
99 |
|
|
* @param argv the command line options |
100 |
|
|
* @param args_info the structure where option information will be stored |
101 |
|
|
* @param params additional parameters for the parser |
102 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
103 |
|
|
*/ |
104 |
|
|
int cmdline_parser_ext (int argc, char **argv, |
105 |
|
|
struct gengetopt_args_info *args_info, |
106 |
|
|
struct cmdline_parser_params *params); |
107 |
|
|
|
108 |
|
|
/** |
109 |
|
|
* Save the contents of the option struct into an already open FILE stream. |
110 |
|
|
* @param outfile the stream where to dump options |
111 |
|
|
* @param args_info the option struct to dump |
112 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
113 |
|
|
*/ |
114 |
|
|
int cmdline_parser_dump(FILE *outfile, |
115 |
|
|
struct gengetopt_args_info *args_info); |
116 |
|
|
|
117 |
|
|
/** |
118 |
|
|
* Save the contents of the option struct into a (text) file. |
119 |
|
|
* This file can be read by the config file parser (if generated by gengetopt) |
120 |
|
|
* @param filename the file where to save |
121 |
|
|
* @param args_info the option struct to save |
122 |
|
|
* @return 0 if everything went fine, NON 0 if an error took place |
123 |
|
|
*/ |
124 |
|
|
int cmdline_parser_file_save(const char *filename, |
125 |
|
|
struct gengetopt_args_info *args_info); |
126 |
|
|
|
127 |
|
|
/** |
128 |
|
|
* Print the help |
129 |
|
|
*/ |
130 |
|
|
void cmdline_parser_print_help(void); |
131 |
|
|
/** |
132 |
|
|
* Print the version |
133 |
|
|
*/ |
134 |
|
|
void cmdline_parser_print_version(void); |
135 |
|
|
|
136 |
|
|
/** |
137 |
|
|
* Initializes all the fields a cmdline_parser_params structure |
138 |
|
|
* to their default values |
139 |
|
|
* @param params the structure to initialize |
140 |
|
|
*/ |
141 |
|
|
void cmdline_parser_params_init(struct cmdline_parser_params *params); |
142 |
|
|
|
143 |
|
|
/** |
144 |
|
|
* Allocates dynamically a cmdline_parser_params structure and initializes |
145 |
|
|
* all its fields to their default values |
146 |
|
|
* @return the created and initialized cmdline_parser_params structure |
147 |
|
|
*/ |
148 |
|
|
struct cmdline_parser_params *cmdline_parser_params_create(void); |
149 |
|
|
|
150 |
|
|
/** |
151 |
|
|
* Initializes the passed gengetopt_args_info structure's fields |
152 |
|
|
* (also set default values for options that have a default) |
153 |
|
|
* @param args_info the structure to initialize |
154 |
|
|
*/ |
155 |
|
|
void cmdline_parser_init (struct gengetopt_args_info *args_info); |
156 |
|
|
/** |
157 |
|
|
* Deallocates the string fields of the gengetopt_args_info structure |
158 |
|
|
* (but does not deallocate the structure itself) |
159 |
|
|
* @param args_info the structure to deallocate |
160 |
|
|
*/ |
161 |
|
|
void cmdline_parser_free (struct gengetopt_args_info *args_info); |
162 |
|
|
|
163 |
|
|
/** |
164 |
|
|
* Checks that all the required options were specified |
165 |
|
|
* @param args_info the structure to check |
166 |
|
|
* @param prog_name the name of the program that will be used to print |
167 |
|
|
* possible errors |
168 |
|
|
* @return |
169 |
|
|
*/ |
170 |
|
|
int cmdline_parser_required (struct gengetopt_args_info *args_info, |
171 |
|
|
const char *prog_name); |
172 |
|
|
|
173 |
|
|
|
174 |
|
|
#ifdef __cplusplus |
175 |
|
|
} |
176 |
|
|
#endif /* __cplusplus */ |
177 |
|
|
#endif /* RECENTERCMD_H */ |