File: cmdline1.h.texinfo

package info (click to toggle)
gengetopt 2.22.6%2Bdfsg0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,732 kB
  • sloc: cpp: 14,709; sh: 11,845; ansic: 8,030; makefile: 689; yacc: 514; lex: 171; sed: 3
file content (237 lines) | stat: -rw-r--r-- 14,362 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
@c Generator: GNU source-highlight, by Lorenzo Bettini, http://www.gnu.org/software/src-highlite
@example
@r{@i{/** }}@b{@@file}@r{@i{ cmdline1.h}}
@r{@i{ *  }}@b{@@brief}@r{@i{ The header file for the command line option parser}}
@r{@i{ *  generated by GNU Gengetopt version 2.22.6}}
@r{@i{ *  }}@t{http://www.gnu.org/software/gengetopt.}
@r{@i{ *  DO NOT modify this file, since it can be overwritten}}
@r{@i{ *  }}@b{@@author}@r{@i{ GNU Gengetopt by Lorenzo Bettini */}}

@b{#ifndef} CMDLINE1_H
@b{#define} CMDLINE1_H

@r{@i{/* If we use autoconf.  */}}
@b{#ifdef} HAVE_CONFIG_H
@b{#include} @t{"config.h"}
@b{#endif}

@b{#include} @t{<stdio.h>} @r{@i{/* for FILE */}}

@b{#ifdef} __cplusplus
@b{extern} @t{"C"} @{
@b{#endif} @r{@i{/* __cplusplus */}}

@b{#ifndef} CMDLINE_PARSER_PACKAGE
@r{@i{/** }}@b{@@brief}@r{@i{ the program name (used for printing errors) */}}
@b{#define} CMDLINE_PARSER_PACKAGE @t{"sample1"}
@b{#endif}

@b{#ifndef} CMDLINE_PARSER_PACKAGE_NAME
@r{@i{/** }}@b{@@brief}@r{@i{ the complete program name (used for help and version) */}}
@b{#define} CMDLINE_PARSER_PACKAGE_NAME @t{"sample1"}
@b{#endif}

@b{#ifndef} CMDLINE_PARSER_VERSION
@r{@i{/** }}@b{@@brief}@r{@i{ the program version */}}
@b{#define} CMDLINE_PARSER_VERSION @t{"2.0"}
@b{#endif}

@r{@i{/** }}@b{@@brief}@r{@i{ Where the command line options are stored */}}
@b{struct} gengetopt_args_info
@{
  @b{const} @b{char} *help_help; @r{@i{/**< }}@b{@@brief}@r{@i{ Print help and exit help description.  */}}
  @b{const} @b{char} *detailed_help_help; @r{@i{/**< }}@b{@@brief}@r{@i{ Print help, including all details and hidden options, and exit help description.  */}}
  @b{const} @b{char} *full_help_help; @r{@i{/**< }}@b{@@brief}@r{@i{ Print help, including hidden options, and exit help description.  */}}
  @b{const} @b{char} *version_help; @r{@i{/**< }}@b{@@brief}@r{@i{ Print version and exit help description.  */}}
  @b{char} * str_opt_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ A string option, for a filename.  */}}
  @b{char} * str_opt_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ A string option, for a filename original value given at command line.  */}}
  @b{const} @b{char} *str_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A string option, for a filename help description.  */}}
  @b{int} my_opt_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I}}
@r{@i{  require a line break.  */}}
  @b{char} * my_opt_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I}}
@r{@i{  require a line break original value given at command line.  */}}
  @b{const} @b{char} *my_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ Another integer option, this time the description of the option should be \"quite\" long to require wrapping... possibly more than one wrapping :-) especially if I}}
@r{@i{  require a line break help description.  */}}
  @b{int} int_opt_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ A int option.  */}}
  @b{char} * int_opt_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ A int option original value given at command line.  */}}
  @b{const} @b{char} *int_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A int option help description.  */}}
  @b{int} flag_opt_flag;       @r{@i{/**< }}@b{@@brief}@r{@i{ A flag option (default=off).  */}}
  @b{const} @b{char} *flag_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A flag option help description.  */}}
  @b{const} @b{char} *funct_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A function option help description.  */}}
  @b{long} long_opt_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ A long option.  */}}
  @b{char} * long_opt_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ A long option original value given at command line.  */}}
  @b{const} @b{char} *long_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A long option help description.  */}}
  @b{char} * def_opt_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ A string option with default (default='Hello').  */}}
  @b{char} * def_opt_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ A string option with default original value given at command line.  */}}
  @b{const} @b{char} *def_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A string option with default help description.  */}}
  @b{char} * enum_opt_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ A string option with list of values (default='hello').  */}}
  @b{char} * enum_opt_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ A string option with list of values original value given at command line.  */}}
  @b{const} @b{char} *enum_opt_help; @r{@i{/**< }}@b{@@brief}@r{@i{ A string option with list of values help description.  */}}
  @b{int} secret_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ hidden option will not appear in --help.  */}}
  @b{char} * secret_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ hidden option will not appear in --help original value given at command line.  */}}
  @b{const} @b{char} *secret_help; @r{@i{/**< }}@b{@@brief}@r{@i{ hidden option will not appear in --help help description.  */}}
  @b{int} dependant_arg;       @r{@i{/**< }}@b{@@brief}@r{@i{ option that depends on str-opt.  */}}
  @b{char} * dependant_orig;       @r{@i{/**< }}@b{@@brief}@r{@i{ option that depends on str-opt original value given at command line.  */}}
  @b{const} @b{char} *dependant_help; @r{@i{/**< }}@b{@@brief}@r{@i{ option that depends on str-opt help description.  */}}
  
  @b{unsigned} @b{int} help_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether help was given.  */}}
  @b{unsigned} @b{int} detailed_help_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether detailed-help was given.  */}}
  @b{unsigned} @b{int} full_help_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether full-help was given.  */}}
  @b{unsigned} @b{int} version_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether version was given.  */}}
  @b{unsigned} @b{int} str_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether str-opt was given.  */}}
  @b{unsigned} @b{int} my_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether my-opt was given.  */}}
  @b{unsigned} @b{int} int_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether int-opt was given.  */}}
  @b{unsigned} @b{int} flag_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether flag-opt was given.  */}}
  @b{unsigned} @b{int} funct_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether funct-opt was given.  */}}
  @b{unsigned} @b{int} long_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether long-opt was given.  */}}
  @b{unsigned} @b{int} def_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether def-opt was given.  */}}
  @b{unsigned} @b{int} enum_opt_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether enum-opt was given.  */}}
  @b{unsigned} @b{int} secret_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether secret was given.  */}}
  @b{unsigned} @b{int} dependant_given ;       @r{@i{/**< }}@b{@@brief}@r{@i{ Whether dependant was given.  */}}

  @b{char} **inputs ; @r{@i{/**< }}@b{@@brief}@r{@i{ unamed options (options without names) */}}
  @b{unsigned} inputs_num ; @r{@i{/**< }}@b{@@brief}@r{@i{ unamed options number */}}
@} ;

@r{@i{/** }}@b{@@brief}@r{@i{ The additional parameters to pass to parser functions */}}
@b{struct} cmdline_parser_params
@{
  @b{int} override; @r{@i{/**< }}@b{@@brief}@r{@i{ whether to override possibly already present options (default 0) */}}
  @b{int} initialize; @r{@i{/**< }}@b{@@brief}@r{@i{ whether to initialize the option structure gengetopt_args_info (default 1) */}}
  @b{int} check_required; @r{@i{/**< }}@b{@@brief}@r{@i{ whether to check that all required options were provided (default 1) */}}
  @b{int} check_ambiguity; @r{@i{/**< }}@b{@@brief}@r{@i{ whether to check for options already specified in the option structure gengetopt_args_info (default 0) */}}
  @b{int} print_errors; @r{@i{/**< }}@b{@@brief}@r{@i{ whether getopt_long should print an error message for a bad option (default 1) */}}
@} ;

@r{@i{/** }}@b{@@brief}@r{@i{ the purpose string of the program */}}
@b{extern} @b{const} @b{char} *gengetopt_args_info_purpose;
@r{@i{/** }}@b{@@brief}@r{@i{ the usage string of the program */}}
@b{extern} @b{const} @b{char} *gengetopt_args_info_usage;
@r{@i{/** }}@b{@@brief}@r{@i{ the description string of the program */}}
@b{extern} @b{const} @b{char} *gengetopt_args_info_description;
@r{@i{/** }}@b{@@brief}@r{@i{ all the lines making the help output */}}
@b{extern} @b{const} @b{char} *gengetopt_args_info_help[];
@r{@i{/** }}@b{@@brief}@r{@i{ all the lines making the full help output (including hidden options) */}}
@b{extern} @b{const} @b{char} *gengetopt_args_info_full_help[];
@r{@i{/** }}@b{@@brief}@r{@i{ all the lines making the detailed help output (including hidden options and details) */}}
@b{extern} @b{const} @b{char} *gengetopt_args_info_detailed_help[];

@r{@i{/**}}
@r{@i{ * The command line parser}}
@r{@i{ * }}@b{@@param}@r{@i{ argc the number of command line options}}
@r{@i{ * }}@b{@@param}@r{@i{ argv the command line options}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the structure where option information will be stored}}
@r{@i{ * }}@b{@@return}@r{@i{ 0 if everything went fine, NON 0 if an error took place}}
@r{@i{ */}}
@b{int} cmdline_parser (@b{int} argc, @b{char} **argv,
  @b{struct} gengetopt_args_info *args_info);

@r{@i{/**}}
@r{@i{ * The command line parser (version with additional parameters - deprecated)}}
@r{@i{ * }}@b{@@param}@r{@i{ argc the number of command line options}}
@r{@i{ * }}@b{@@param}@r{@i{ argv the command line options}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the structure where option information will be stored}}
@r{@i{ * }}@b{@@param}@r{@i{ override whether to override possibly already present options}}
@r{@i{ * }}@b{@@param}@r{@i{ initialize whether to initialize the option structure my_args_info}}
@r{@i{ * }}@b{@@param}@r{@i{ check_required whether to check that all required options were provided}}
@r{@i{ * }}@b{@@return}@r{@i{ 0 if everything went fine, NON 0 if an error took place}}
@r{@i{ * }}@b{@@deprecated}@r{@i{ use cmdline_parser_ext() instead}}
@r{@i{ */}}
@b{int} cmdline_parser2 (@b{int} argc, @b{char} **argv,
  @b{struct} gengetopt_args_info *args_info,
  @b{int} override, @b{int} initialize, @b{int} check_required);

@r{@i{/**}}
@r{@i{ * The command line parser (version with additional parameters)}}
@r{@i{ * }}@b{@@param}@r{@i{ argc the number of command line options}}
@r{@i{ * }}@b{@@param}@r{@i{ argv the command line options}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the structure where option information will be stored}}
@r{@i{ * }}@b{@@param}@r{@i{ params additional parameters for the parser}}
@r{@i{ * }}@b{@@return}@r{@i{ 0 if everything went fine, NON 0 if an error took place}}
@r{@i{ */}}
@b{int} cmdline_parser_ext (@b{int} argc, @b{char} **argv,
  @b{struct} gengetopt_args_info *args_info,
  @b{struct} cmdline_parser_params *params);

@r{@i{/**}}
@r{@i{ * Save the contents of the option struct into an already open FILE stream.}}
@r{@i{ * }}@b{@@param}@r{@i{ outfile the stream where to dump options}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the option struct to dump}}
@r{@i{ * }}@b{@@return}@r{@i{ 0 if everything went fine, NON 0 if an error took place}}
@r{@i{ */}}
@b{int} cmdline_parser_dump(FILE *outfile,
  @b{struct} gengetopt_args_info *args_info);

@r{@i{/**}}
@r{@i{ * Save the contents of the option struct into a (text) file.}}
@r{@i{ * This file can be read by the config file parser (if generated by gengetopt)}}
@r{@i{ * }}@b{@@param}@r{@i{ filename the file where to save}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the option struct to save}}
@r{@i{ * }}@b{@@return}@r{@i{ 0 if everything went fine, NON 0 if an error took place}}
@r{@i{ */}}
@b{int} cmdline_parser_file_save(@b{const} @b{char} *filename,
  @b{struct} gengetopt_args_info *args_info);

@r{@i{/**}}
@r{@i{ * Print the help}}
@r{@i{ */}}
@b{void} cmdline_parser_print_help(@b{void});
@r{@i{/**}}
@r{@i{ * Print the full help (including hidden options)}}
@r{@i{ */}}
@b{void} cmdline_parser_print_full_help(@b{void});
@r{@i{/**}}
@r{@i{ * Print the detailed help (including hidden options and details)}}
@r{@i{ */}}
@b{void} cmdline_parser_print_detailed_help(@b{void});
@r{@i{/**}}
@r{@i{ * Print the version}}
@r{@i{ */}}
@b{void} cmdline_parser_print_version(@b{void});

@r{@i{/**}}
@r{@i{ * Initializes all the fields a cmdline_parser_params structure }}
@r{@i{ * to their default values}}
@r{@i{ * }}@b{@@param}@r{@i{ params the structure to initialize}}
@r{@i{ */}}
@b{void} cmdline_parser_params_init(@b{struct} cmdline_parser_params *params);

@r{@i{/**}}
@r{@i{ * Allocates dynamically a cmdline_parser_params structure and initializes}}
@r{@i{ * all its fields to their default values}}
@r{@i{ * }}@b{@@return}@r{@i{ the created and initialized cmdline_parser_params structure}}
@r{@i{ */}}
@b{struct} cmdline_parser_params *cmdline_parser_params_create(@b{void});

@r{@i{/**}}
@r{@i{ * Initializes the passed gengetopt_args_info structure's fields}}
@r{@i{ * (also set default values for options that have a default)}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the structure to initialize}}
@r{@i{ */}}
@b{void} cmdline_parser_init (@b{struct} gengetopt_args_info *args_info);
@r{@i{/**}}
@r{@i{ * Deallocates the string fields of the gengetopt_args_info structure}}
@r{@i{ * (but does not deallocate the structure itself)}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the structure to deallocate}}
@r{@i{ */}}
@b{void} cmdline_parser_free (@b{struct} gengetopt_args_info *args_info);

@r{@i{/**}}
@r{@i{ * Checks that all the required options were specified}}
@r{@i{ * }}@b{@@param}@r{@i{ args_info the structure to check}}
@r{@i{ * }}@b{@@param}@r{@i{ prog_name the name of the program that will be used to print}}
@r{@i{ *   possible errors}}
@r{@i{ * }}@b{@@return}
@r{@i{ */}}
@b{int} cmdline_parser_required (@b{struct} gengetopt_args_info *args_info,
  @b{const} @b{char} *prog_name);

@b{extern} @b{const} @b{char} *cmdline_parser_enum_opt_values[];  @r{@i{/**< }}@b{@@brief}@r{@i{ Possible values for enum-opt. */}}


@b{#ifdef} __cplusplus
@}
@b{#endif} @r{@i{/* __cplusplus */}}
@b{#endif} @r{@i{/* CMDLINE1_H */}}

@end example