Node:Argp Global Variables, Next:, Up:Argp



Argp Global Variables

These variables make it very easy for every user program to implement the --version option and provide a bug-reporting address in the --help output (which is implemented by argp regardless).

const char * argp_program_version Variable
If defined or set by the user program to a non-zero value, then a --version option is added when parsing with argp_parse (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used).

const char * argp_program_bug_address Variable
If defined or set by the user program to a non-zero value, argp_program_bug_address should point to a string that is the bug-reporting address for the program. It will be printed at the end of the standard output for the --help option, embedded in a sentence that says something like Report bugs to address..

argp_program_version_hook Variable
If defined or set by the user program to a non-zero value, then a --version option is added when parsing with argp_parse (unless the ARGP_NO_HELP flag is used), which calls this function to print the version, and then exits with a status of 0 (unless the ARGP_NO_EXIT flag is used). It should point to a function with the following type signature:
void print-version (FILE *stream, struct argp_state *state)
See Argp Parsing State, for an explanation of state. This variable takes precedent over argp_program_version, and is useful if a program has version information that cannot be easily specified as a simple string.

error_t argp_err_exit_status Variable
The exit status that argp will use when exiting due to a parsing error. If not defined or set by the user program, this defaults to EX_USAGE from <sysexits.h>.