Airframe options interface.
More...
#include <airframe/autoinc.h>
Go to the source code of this file.
|
typedef struct _AirOptionCtx | AirOptionCtx |
| Opaque options context structure.
|
|
Airframe options interface.
◆ air_opterr()
void air_opterr |
( |
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Print a formatted option error message on standard error and exit the process.
Use this only during command-line option processing. This call will not return.
- Parameters
-
fmt | format string of error message |
◆ air_option_context_add_group()
gboolean air_option_context_add_group |
( |
AirOptionCtx * |
aoctx, |
|
|
const char * |
shortname, |
|
|
const char * |
longname, |
|
|
const char * |
description, |
|
|
AirOptionEntry * |
entries |
|
) |
| |
Add a group of options to an option context.
- Parameters
-
aoctx | AirOptionCtx to be modified |
shortname | A short name for the group, which should not contains spaces |
longname | The full name of the option group, shown in help |
description | A brief description of the option group shown in help |
entries | An array of AF_OPTION structures terminated by AF_OPTION_END |
- Returns
- TRUE if group add was successful, FALSE otherwise
◆ air_option_context_free()
Destroy an options context.
- Parameters
-
aoctx | AirOptionCtx to be freed. |
◆ air_option_context_new()
AirOptionCtx* air_option_context_new |
( |
const char * |
helpstr, |
|
|
int * |
argc, |
|
|
char *** |
argv, |
|
|
AirOptionEntry * |
entries |
|
) |
| |
Create a new option context.
- Parameters
-
helpstr | Text to be displayed after the name of the command in help |
argc | The address of the program's argc count |
argv | The address of the program's argv array |
entries | An array of AF_OPTION structures terminated by AF_OPTION_END |
- Returns
- An initialized AirOptionCtx, or NULL if an error occurred.
◆ air_option_context_parse()
Parse command line arguments based on option entries that have been added to the option context.
The argc and argv associated with the context will be updated by this function, with recognized options removed. Prints an error to standard error and terminates the process if the command-line cannot be parsed.
- Parameters
-
aoctx | AirOptionCtx to be parsed |
◆ air_option_context_set_help_enabled()
void air_option_context_set_help_enabled |
( |
AirOptionCtx * |
aoctx | ) |
|
Enable the display of option help by invoking your program with the –help or –usage parameters.
- Parameters
-
aoctx | AirOptionCtx to be modified. |
◆ air_option_context_usage()
Print a command line option usage message for your program, if supported by the underlying options library.
- Parameters
-
aoctx | AirOptionCtx to be displayed. |