#include <wgetopt.h>
Data Fields | |
| wchar_t * | name |
| long name for switch | |
| int | has_arg |
| Must be one of no_argument, required_argument and optional_argument. | |
| int * | flag |
| If non-null, the flag whose value should be set if this switch is encountered. | |
| int | val |
If flag is non-null, this is the value that flag will be set to. | |
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector of `struct option' terminated by an element containing a name which is zero.
The field `has_arg' is: no_argument (or 0) if the option does not take an argument, required_argument (or 1) if the option requires an argument, optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set to the value given in the field `val' when the option is found, but left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to a compiled-in constant, such as set a value from `optarg', set the option's `flag' field to zero and its `val' field to a nonzero value (the equivalent single-letter option character, if there is one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field.
|
|
Must be one of no_argument, required_argument and optional_argument. has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. |
|
|
If Otherwise, this is the return-value of the function call. |
1.4.4