Airframe Application Utilities
libairframe 2.12.0 API documentation

Typedefs | Functions
airopt.h File Reference

Airframe options interface. More...

#include <airframe/autoinc.h>

Go to the source code of this file.

Typedefs

typedef struct _AirOptionCtx AirOptionCtx
 Opaque options context structure.
 

Functions

void air_opterr (const char *fmt,...)
 Print a formatted option error message on standard error and exit the process. More...
 
AirOptionCtxair_option_context_new (const char *helpstr, int *argc, char ***argv, AirOptionEntry *entries)
 Create a new option context. More...
 
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. More...
 
void air_option_context_parse (AirOptionCtx *aoctx)
 Parse command line arguments based on option entries that have been added to the option context. More...
 
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. More...
 
void air_option_context_usage (AirOptionCtx *aoctx)
 Print a command line option usage message for your program, if supported by the underlying options library. More...
 
void air_option_context_free (AirOptionCtx *aoctx)
 Destroy an options context. More...
 

Detailed Description

Airframe options interface.

Function Documentation

◆ 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
fmtformat 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
aoctxAirOptionCtx to be modified
shortnameA short name for the group, which should not contains spaces
longnameThe full name of the option group, shown in help
descriptionA brief description of the option group shown in help
entriesAn array of AF_OPTION structures terminated by AF_OPTION_END
Returns
TRUE if group add was successful, FALSE otherwise

◆ air_option_context_free()

void air_option_context_free ( AirOptionCtx aoctx)

Destroy an options context.

Parameters
aoctxAirOptionCtx 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
helpstrText to be displayed after the name of the command in help
argcThe address of the program's argc count
argvThe address of the program's argv array
entriesAn array of AF_OPTION structures terminated by AF_OPTION_END
Returns
An initialized AirOptionCtx, or NULL if an error occurred.

◆ air_option_context_parse()

void air_option_context_parse ( AirOptionCtx aoctx)

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
aoctxAirOptionCtx 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
aoctxAirOptionCtx to be modified.

◆ air_option_context_usage()

void air_option_context_usage ( AirOptionCtx aoctx)

Print a command line option usage message for your program, if supported by the underlying options library.

Parameters
aoctxAirOptionCtx to be displayed.