1
/** @file test_only_flags_cmd.h
2
* @brief The header file for the command line option parser
3
* generated by GNU Gengetopt
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 TEST_ONLY_FLAGS_CMD_H
9
#define TEST_ONLY_FLAGS_CMD_H
11
/* If we use autoconf. */
16
#include <stdio.h> /* for FILE */
20
#endif /* __cplusplus */
22
#ifndef TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE
23
/** @brief the program name (used for printing errors) */
24
#define TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE "test_only_flags"
27
#ifndef TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME
28
/** @brief the complete program name (used for help and version) */
29
#define TEST_ONLY_FLAGS_CMD_PARSER_PACKAGE_NAME "test_only_flags"
32
#ifndef TEST_ONLY_FLAGS_CMD_PARSER_VERSION
33
/** @brief the program version */
34
#define TEST_ONLY_FLAGS_CMD_PARSER_VERSION "1.0"
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
int foo_flag; /**< @brief foo option (default=on). */
43
const char *foo_help; /**< @brief foo option help description. */
45
unsigned int help_given ; /**< @brief Whether help was given. */
46
unsigned int version_given ; /**< @brief Whether version was given. */
47
unsigned int foo_given ; /**< @brief Whether foo was given. */
49
char **inputs ; /**< @brief unamed options (options without names) */
50
unsigned inputs_num ; /**< @brief unamed options number */
53
/** @brief The additional parameters to pass to parser functions */
54
struct test_only_flags_cmd_parser_params
56
int override; /**< @brief whether to override possibly already present options (default 0) */
57
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
58
int check_required; /**< @brief whether to check that all required options were provided (default 1) */
59
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
60
int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
63
/** @brief the purpose string of the program */
64
extern const char *gengetopt_args_info_purpose;
65
/** @brief the usage string of the program */
66
extern const char *gengetopt_args_info_usage;
67
/** @brief all the lines making the help output */
68
extern const char *gengetopt_args_info_help[];
71
* The command line parser
72
* @param argc the number of command line options
73
* @param argv the command line options
74
* @param args_info the structure where option information will be stored
75
* @return 0 if everything went fine, NON 0 if an error took place
77
int test_only_flags_cmd_parser (int argc, char **argv,
78
struct gengetopt_args_info *args_info);
81
* The command line parser (version with additional parameters - deprecated)
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
* @param override whether to override possibly already present options
86
* @param initialize whether to initialize the option structure my_args_info
87
* @param check_required whether to check that all required options were provided
88
* @return 0 if everything went fine, NON 0 if an error took place
89
* @deprecated use test_only_flags_cmd_parser_ext() instead
91
int test_only_flags_cmd_parser2 (int argc, char **argv,
92
struct gengetopt_args_info *args_info,
93
int override, int initialize, int check_required);
96
* The command line parser (version with additional parameters)
97
* @param argc the number of command line options
98
* @param argv the command line options
99
* @param args_info the structure where option information will be stored
100
* @param params additional parameters for the parser
101
* @return 0 if everything went fine, NON 0 if an error took place
103
int test_only_flags_cmd_parser_ext (int argc, char **argv,
104
struct gengetopt_args_info *args_info,
105
struct test_only_flags_cmd_parser_params *params);
108
* Save the contents of the option struct into an already open FILE stream.
109
* @param outfile the stream where to dump options
110
* @param args_info the option struct to dump
111
* @return 0 if everything went fine, NON 0 if an error took place
113
int test_only_flags_cmd_parser_dump(FILE *outfile,
114
struct gengetopt_args_info *args_info);
117
* Save the contents of the option struct into a (text) file.
118
* This file can be read by the config file parser (if generated by gengetopt)
119
* @param filename the file where to save
120
* @param args_info the option struct to save
121
* @return 0 if everything went fine, NON 0 if an error took place
123
int test_only_flags_cmd_parser_file_save(const char *filename,
124
struct gengetopt_args_info *args_info);
129
void test_only_flags_cmd_parser_print_help(void);
133
void test_only_flags_cmd_parser_print_version(void);
136
* Initializes all the fields a test_only_flags_cmd_parser_params structure
137
* to their default values
138
* @param params the structure to initialize
140
void test_only_flags_cmd_parser_params_init(struct test_only_flags_cmd_parser_params *params);
143
* Allocates dynamically a test_only_flags_cmd_parser_params structure and initializes
144
* all its fields to their default values
145
* @return the created and initialized test_only_flags_cmd_parser_params structure
147
struct test_only_flags_cmd_parser_params *test_only_flags_cmd_parser_params_create(void);
150
* Initializes the passed gengetopt_args_info structure's fields
151
* (also set default values for options that have a default)
152
* @param args_info the structure to initialize
154
void test_only_flags_cmd_parser_init (struct gengetopt_args_info *args_info);
156
* Deallocates the string fields of the gengetopt_args_info structure
157
* (but does not deallocate the structure itself)
158
* @param args_info the structure to deallocate
160
void test_only_flags_cmd_parser_free (struct gengetopt_args_info *args_info);
163
* Checks that all the required options were specified
164
* @param args_info the structure to check
165
* @param prog_name the name of the program that will be used to print
169
int test_only_flags_cmd_parser_required (struct gengetopt_args_info *args_info,
170
const char *prog_name);
175
#endif /* __cplusplus */
176
#endif /* TEST_ONLY_FLAGS_CMD_H */