aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_getopt_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_getopt_lib.h')
-rw-r--r--src/include/gnunet_getopt_lib.h142
1 files changed, 72 insertions, 70 deletions
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h
index ef744fbc9..0d6ed4fc7 100644
--- a/src/include/gnunet_getopt_lib.h
+++ b/src/include/gnunet_getopt_lib.h
@@ -44,7 +44,8 @@ extern "C" {
44/** 44/**
45 * @brief General context for command line processors. 45 * @brief General context for command line processors.
46 */ 46 */
47struct GNUNET_GETOPT_CommandLineProcessorContext { 47struct GNUNET_GETOPT_CommandLineProcessorContext
48{
48 /** 49 /**
49 * Name of the application 50 * Name of the application
50 */ 51 */
@@ -96,7 +97,8 @@ typedef int (*GNUNET_GETOPT_CommandLineOptionProcessor) (
96/** 97/**
97 * @brief Definition of a command line option. 98 * @brief Definition of a command line option.
98 */ 99 */
99struct GNUNET_GETOPT_CommandLineOption { 100struct GNUNET_GETOPT_CommandLineOption
101{
100 /** 102 /**
101 * Short name of the option. 103 * Short name of the option.
102 */ 104 */
@@ -158,7 +160,7 @@ struct GNUNET_GETOPT_CommandLineOption {
158 * @param about string with brief description of the application 160 * @param about string with brief description of the application
159 */ 161 */
160struct GNUNET_GETOPT_CommandLineOption 162struct GNUNET_GETOPT_CommandLineOption
161GNUNET_GETOPT_option_help(const char *about); 163GNUNET_GETOPT_option_help (const char *about);
162 164
163 165
164/** 166/**
@@ -168,7 +170,7 @@ GNUNET_GETOPT_option_help(const char *about);
168 * @param version string with the version number 170 * @param version string with the version number
169 */ 171 */
170struct GNUNET_GETOPT_CommandLineOption 172struct GNUNET_GETOPT_CommandLineOption
171GNUNET_GETOPT_option_version(const char *version); 173GNUNET_GETOPT_option_version (const char *version);
172 174
173 175
174/** 176/**
@@ -177,7 +179,7 @@ GNUNET_GETOPT_option_version(const char *version);
177 * @param[out] logfn set to the name of the logfile 179 * @param[out] logfn set to the name of the logfile
178 */ 180 */
179struct GNUNET_GETOPT_CommandLineOption 181struct GNUNET_GETOPT_CommandLineOption
180GNUNET_GETOPT_option_logfile(char **logfn); 182GNUNET_GETOPT_option_logfile (char **logfn);
181 183
182 184
183/** 185/**
@@ -190,11 +192,11 @@ GNUNET_GETOPT_option_logfile(char **logfn);
190 * @param[out] str set to the string 192 * @param[out] str set to the string
191 */ 193 */
192struct GNUNET_GETOPT_CommandLineOption 194struct GNUNET_GETOPT_CommandLineOption
193GNUNET_GETOPT_option_string(char shortName, 195GNUNET_GETOPT_option_string (char shortName,
194 const char *name, 196 const char *name,
195 const char *argumentHelp, 197 const char *argumentHelp,
196 const char *description, 198 const char *description,
197 char **str); 199 char **str);
198 200
199/** 201/**
200 * Allow user to specify a filename (automatically path expanded). 202 * Allow user to specify a filename (automatically path expanded).
@@ -206,11 +208,11 @@ GNUNET_GETOPT_option_string(char shortName,
206 * @param[out] str set to the string 208 * @param[out] str set to the string
207 */ 209 */
208struct GNUNET_GETOPT_CommandLineOption 210struct GNUNET_GETOPT_CommandLineOption
209GNUNET_GETOPT_option_filename(char shortName, 211GNUNET_GETOPT_option_filename (char shortName,
210 const char *name, 212 const char *name,
211 const char *argumentHelp, 213 const char *argumentHelp,
212 const char *description, 214 const char *description,
213 char **str); 215 char **str);
214 216
215 217
216/** 218/**
@@ -225,12 +227,12 @@ GNUNET_GETOPT_option_filename(char shortName,
225 * @param val_size size of @a val in bytes 227 * @param val_size size of @a val in bytes
226 */ 228 */
227struct GNUNET_GETOPT_CommandLineOption 229struct GNUNET_GETOPT_CommandLineOption
228GNUNET_GETOPT_option_base32_fixed_size(char shortName, 230GNUNET_GETOPT_option_base32_fixed_size (char shortName,
229 const char *name, 231 const char *name,
230 const char *argumentHelp, 232 const char *argumentHelp,
231 const char *description, 233 const char *description,
232 void *val, 234 void *val,
233 size_t val_size); 235 size_t val_size);
234 236
235 237
236/** 238/**
@@ -250,12 +252,12 @@ GNUNET_GETOPT_option_base32_fixed_size(char shortName,
250 argumentHelp, \ 252 argumentHelp, \
251 description, \ 253 description, \
252 val) \ 254 val) \
253 GNUNET_GETOPT_option_base32_fixed_size(shortName, \ 255 GNUNET_GETOPT_option_base32_fixed_size (shortName, \
254 name, \ 256 name, \
255 argumentHelp, \ 257 argumentHelp, \
256 description, \ 258 description, \
257 val, \ 259 val, \
258 sizeof(*val)) 260 sizeof(*val))
259 261
260 262
261/** 263/**
@@ -268,10 +270,10 @@ GNUNET_GETOPT_option_base32_fixed_size(char shortName,
268 * @param[out] val set to 1 if the option is present 270 * @param[out] val set to 1 if the option is present
269 */ 271 */
270struct GNUNET_GETOPT_CommandLineOption 272struct GNUNET_GETOPT_CommandLineOption
271GNUNET_GETOPT_option_flag(char shortName, 273GNUNET_GETOPT_option_flag (char shortName,
272 const char *name, 274 const char *name,
273 const char *description, 275 const char *description,
274 int *val); 276 int *val);
275 277
276 278
277/** 279/**
@@ -284,11 +286,11 @@ GNUNET_GETOPT_option_flag(char shortName,
284 * @param[out] val set to the value specified at the command line 286 * @param[out] val set to the value specified at the command line
285 */ 287 */
286struct GNUNET_GETOPT_CommandLineOption 288struct GNUNET_GETOPT_CommandLineOption
287GNUNET_GETOPT_option_uint(char shortName, 289GNUNET_GETOPT_option_uint (char shortName,
288 const char *name, 290 const char *name,
289 const char *argumentHelp, 291 const char *argumentHelp,
290 const char *description, 292 const char *description,
291 unsigned int *val); 293 unsigned int *val);
292 294
293 295
294/** 296/**
@@ -301,11 +303,11 @@ GNUNET_GETOPT_option_uint(char shortName,
301 * @param[out] val set to the value specified at the command line 303 * @param[out] val set to the value specified at the command line
302 */ 304 */
303struct GNUNET_GETOPT_CommandLineOption 305struct GNUNET_GETOPT_CommandLineOption
304GNUNET_GETOPT_option_uint16(char shortName, 306GNUNET_GETOPT_option_uint16 (char shortName,
305 const char *name, 307 const char *name,
306 const char *argumentHelp, 308 const char *argumentHelp,
307 const char *description, 309 const char *description,
308 uint16_t *val); 310 uint16_t *val);
309 311
310 312
311/** 313/**
@@ -318,11 +320,11 @@ GNUNET_GETOPT_option_uint16(char shortName,
318 * @param[out] val set to the value specified at the command line 320 * @param[out] val set to the value specified at the command line
319 */ 321 */
320struct GNUNET_GETOPT_CommandLineOption 322struct GNUNET_GETOPT_CommandLineOption
321GNUNET_GETOPT_option_ulong(char shortName, 323GNUNET_GETOPT_option_ulong (char shortName,
322 const char *name, 324 const char *name,
323 const char *argumentHelp, 325 const char *argumentHelp,
324 const char *description, 326 const char *description,
325 unsigned long long *val); 327 unsigned long long *val);
326 328
327 329
328/** 330/**
@@ -336,11 +338,11 @@ GNUNET_GETOPT_option_ulong(char shortName,
336 * @param[out] val set to the time specified at the command line 338 * @param[out] val set to the time specified at the command line
337 */ 339 */
338struct GNUNET_GETOPT_CommandLineOption 340struct GNUNET_GETOPT_CommandLineOption
339GNUNET_GETOPT_option_relative_time(char shortName, 341GNUNET_GETOPT_option_relative_time (char shortName,
340 const char *name, 342 const char *name,
341 const char *argumentHelp, 343 const char *argumentHelp,
342 const char *description, 344 const char *description,
343 struct GNUNET_TIME_Relative *val); 345 struct GNUNET_TIME_Relative *val);
344 346
345 347
346/** 348/**
@@ -354,11 +356,11 @@ GNUNET_GETOPT_option_relative_time(char shortName,
354 * @param[out] val set to the time specified at the command line 356 * @param[out] val set to the time specified at the command line
355 */ 357 */
356struct GNUNET_GETOPT_CommandLineOption 358struct GNUNET_GETOPT_CommandLineOption
357GNUNET_GETOPT_option_absolute_time(char shortName, 359GNUNET_GETOPT_option_absolute_time (char shortName,
358 const char *name, 360 const char *name,
359 const char *argumentHelp, 361 const char *argumentHelp,
360 const char *description, 362 const char *description,
361 struct GNUNET_TIME_Absolute *val); 363 struct GNUNET_TIME_Absolute *val);
362 364
363 365
364/** 366/**
@@ -371,10 +373,10 @@ GNUNET_GETOPT_option_absolute_time(char shortName,
371 * @param[out] val set to 1 if the option is present 373 * @param[out] val set to 1 if the option is present
372 */ 374 */
373struct GNUNET_GETOPT_CommandLineOption 375struct GNUNET_GETOPT_CommandLineOption
374GNUNET_GETOPT_option_increment_uint(char shortName, 376GNUNET_GETOPT_option_increment_uint (char shortName,
375 const char *name, 377 const char *name,
376 const char *description, 378 const char *description,
377 unsigned int *val); 379 unsigned int *val);
378 380
379 381
380/** 382/**
@@ -384,7 +386,7 @@ GNUNET_GETOPT_option_increment_uint(char shortName,
384 * @param[out] level set to the log level 386 * @param[out] level set to the log level
385 */ 387 */
386struct GNUNET_GETOPT_CommandLineOption 388struct GNUNET_GETOPT_CommandLineOption
387GNUNET_GETOPT_option_loglevel(char **level); 389GNUNET_GETOPT_option_loglevel (char **level);
388 390
389 391
390/** 392/**
@@ -394,7 +396,7 @@ GNUNET_GETOPT_option_loglevel(char **level);
394 * @param[out] level set to the verbosity level 396 * @param[out] level set to the verbosity level
395 */ 397 */
396struct GNUNET_GETOPT_CommandLineOption 398struct GNUNET_GETOPT_CommandLineOption
397GNUNET_GETOPT_option_verbose(unsigned int *level); 399GNUNET_GETOPT_option_verbose (unsigned int *level);
398 400
399 401
400/** 402/**
@@ -403,7 +405,7 @@ GNUNET_GETOPT_option_verbose(unsigned int *level);
403 * @param[out] logfn set to the name of the logfile 405 * @param[out] logfn set to the name of the logfile
404 */ 406 */
405struct GNUNET_GETOPT_CommandLineOption 407struct GNUNET_GETOPT_CommandLineOption
406GNUNET_GETOPT_option_logfile(char **logfn); 408GNUNET_GETOPT_option_logfile (char **logfn);
407 409
408 410
409/** 411/**
@@ -412,7 +414,7 @@ GNUNET_GETOPT_option_logfile(char **logfn);
412 * @param[out] fn set to the name of the configuration file 414 * @param[out] fn set to the name of the configuration file
413 */ 415 */
414struct GNUNET_GETOPT_CommandLineOption 416struct GNUNET_GETOPT_CommandLineOption
415GNUNET_GETOPT_option_cfgfile(char **fn); 417GNUNET_GETOPT_option_cfgfile (char **fn);
416 418
417 419
418/** 420/**
@@ -422,7 +424,7 @@ GNUNET_GETOPT_option_cfgfile(char **fn);
422 * @return @a opt with the mandatory flag set. 424 * @return @a opt with the mandatory flag set.
423 */ 425 */
424struct GNUNET_GETOPT_CommandLineOption 426struct GNUNET_GETOPT_CommandLineOption
425GNUNET_GETOPT_option_mandatory(struct GNUNET_GETOPT_CommandLineOption opt); 427GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt);
426 428
427 429
428/** 430/**
@@ -432,7 +434,7 @@ GNUNET_GETOPT_option_mandatory(struct GNUNET_GETOPT_CommandLineOption opt);
432 * @return @a opt with the exclusive flag set. 434 * @return @a opt with the exclusive flag set.
433 */ 435 */
434struct GNUNET_GETOPT_CommandLineOption 436struct GNUNET_GETOPT_CommandLineOption
435GNUNET_GETOPT_option_exclusive(struct GNUNET_GETOPT_CommandLineOption opt); 437GNUNET_GETOPT_option_exclusive (struct GNUNET_GETOPT_CommandLineOption opt);
436 438
437 439
438/** 440/**
@@ -455,10 +457,10 @@ GNUNET_GETOPT_option_exclusive(struct GNUNET_GETOPT_CommandLineOption opt);
455 * argument, or #GNUNET_SYSERR on error 457 * argument, or #GNUNET_SYSERR on error
456 */ 458 */
457int 459int
458GNUNET_GETOPT_run(const char *binaryOptions, 460GNUNET_GETOPT_run (const char *binaryOptions,
459 const struct GNUNET_GETOPT_CommandLineOption *allOptions, 461 const struct GNUNET_GETOPT_CommandLineOption *allOptions,
460 unsigned int argc, 462 unsigned int argc,
461 char *const *argv); 463 char *const *argv);
462 464
463 465
464#if 0 /* keep Emacsens' auto-indent happy */ 466#if 0 /* keep Emacsens' auto-indent happy */