Airframe Application Utilities
libairframe 0.7.2 API documentation

Main Page | Data Structures | File List | Data Fields | Globals

airopt.h File Reference

Airframe options interface. More...

#include <airframe/autoinc.h>

Go to the source code of this file.


Typedefs

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

Detailed Description

Airframe options interface.


Function Documentation

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

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

void air_option_context_free AirOptionCtx aoctx  ) 
 

Destroy an options context.

Parameters:
aoctx AirOptionCtx to be freed.

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.

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:
aoctx AirOptionCtx to be parsed

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.

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:
aoctx AirOptionCtx to be displayed.