Copyright (C) 2000-2012 |
GNU Info (libc.info)Argp Option VectorsSpecifying Options in an Argp Parser ------------------------------------ The `options' field in a `struct argp' points to a vector of `struct argp_option' structures, each of which specifies an option that the argp parser supports. Multiple entries may be used for a single option provided it has multiple names. This should be terminated by an entry with zero in all fields. Note that when using an initialized C array for options, writing `{ 0 }' is enough to achieve this. - Data Type: struct argp_option This structure specifies a single option that an argp parser understands, as well as how to parse and document that option. It has the following fields: `const char *name' The long name for this option, corresponding to the long option `--NAME'; this field may be zero if this option _only_ has a short name. To specify multiple names for an option, additional entries may follow this one, with the `OPTION_ALIAS' flag set. Note: Argp Option Flags. `int key' The integer key provided by the current option to the option parser. If KEY has a value that is a printable ASCII character (i.e., `isascii (KEY)' is true), it _also_ specifies a short option `-CHAR', where CHAR is the ASCII character with the code KEY. `const char *arg' If non-zero, this is the name of an argument associated with this option, which must be provided (e.g., with the `--NAME=VALUE' or `-CHAR VALUE' syntaxes), unless the `OPTION_ARG_OPTIONAL' flag (Note: Argp Option Flags) is set, in which case it _may_ be provided. `int flags' Flags associated with this option, some of which are referred to above. Note: Argp Option Flags. `const char *doc' A documentation string for this option, for printing in help messages. If both the `name' and `key' fields are zero, this string will be printed tabbed left from the normal option column, making it useful as a group header. This will be the first thing printed in its group. In this usage, it's conventional to end the string with a `:' character. `int group' Group identity for this option. In a long help message, options are sorted alphabetically within each group, and the groups presented in the order 0, 1, 2, ..., N, -M, ..., -2, -1. Every entry in an options array with this field 0 will inherit the group number of the previous entry, or zero if it's the first one. If it's a group header with `name' and `key' fields both zero, the previous entry + 1 is the default. Automagic options such as `--help' are put into group -1. Note that because of C structure initialization rules, this field often need not be specified, because 0 is the correct value.
automatically generated by info2www version 1.2.2.9 |