|
coan 4.2.4
|
|
Data Structures | |
| struct | option |
| struct | cmd_option |
| struct | exclusion_list |
Files | |
| file | get_options.c |
| file | get_options.h |
Typedefs | |
| typedef struct cmd_option | cmd_option_t |
Enumerations | |
| enum | { no_argument, required_argument, optional_argument } |
Functions | |
| cmd_option_t const * | get_command_option (int argc, char *argv[], cmd_option_t const *commands) |
| bool | opts_are_compatible (int opt_excluder, int opt_excluded, struct exclusion_list const *exclusions, bool indexed) |
| int | getopt_long (int argc, char *argv[], const char *optstr, struct option const *longopts, int *longind) |
| const char * | get_long_opt_name (struct option const *longopts, int opt) |
Variables | |
| int | optind |
| int | optopt |
| char * | optarg |
| typedef struct cmd_option cmd_option_t |
Info structure for a command option for get_command()
| anonymous enum |
Possible values of the has_arg field in an option structure
| no_argument |
The option cannot have an argument |
| required_argument |
The option must have an argument |
| optional_argument |
The option mat or may not have an argument |
Definition at line 83 of file get_options.h.
| cmd_option_t const* get_command_option | ( | int | argc, |
| char * | argv[], | ||
| cmd_option_t const * | commands | ||
| ) |
Look for a command option at the start of commandline arguments.
| argc | The number of commandline arguments. |
| argv | The array of commandline arguments. |
| commands | An array of valid command options. |
Definition at line 56 of file get_options.c.
References commands, and cmd_option::name.
Referenced by parse_args().
| const char* get_long_opt_name | ( | struct option const * | longopts, |
| int | opt | ||
| ) |
Look up the long name of the an option in an array of struct option
| longopts | The array of option info to be searched, terminated by a struct option in which the name field is NULL. |
| opt | The option code to be sought. |
Definition at line 253 of file get_options.c.
References option::name, and option::val.
Referenced by error_invalid_opt().
| int getopt_long | ( | int | argc, |
| char * | argv[], | ||
| const char * | optstr, | ||
| struct option const * | longopts, | ||
| int * | longind | ||
| ) |
We need the standard getopt_long() function, but the host implementation cannot be relied on to be re-entrant. Therefore we roll our own re-entrant version. The interface is like that of its standard namesake.
Definition at line 101 of file get_options.c.
References eq(), option::flag, getopt_long(), option::name, no_argument, optarg, optind, optional_argument, optopt, required_argument, and option::val.
Referenced by getopt_long(), and parse_command_args().

| bool opts_are_compatible | ( | int | opt_excluder, |
| int | opt_excluded, | ||
| struct exclusion_list const * | exclusions, | ||
| bool | indexed | ||
| ) |
Say whether options are compatible with respect to specified incompatbilities.
| opt_excluder | To be determined if this option excludes another. |
| opt_excluded | To be determined if this option is excluded by opt_excluder. |
| exclusions | Addresses an array of exclusions lists,terminated by an exclusion list in which the excluder field is 0, in which a list belonging to opt_excluder will be sought. |
| indexed | If true then the function may assume that opt_excluder is an index to its exclusion list in exclusions. |
Definition at line 71 of file get_options.c.
References exclusion_list::excluded, and exclusion_list::excluder.
Referenced by parse_command_args().
| char* optarg |
Argument to an option parsed by getopt_long()
Definition at line 53 of file get_options.c.
Referenced by getopt_long(), and parse_command_args().
| int optind |
Index of option parsed by getopt_long()
Definition at line 51 of file get_options.c.
Referenced by getopt_long(), and parse_command_args().
| int optopt |
Unrecogised short option parsed by getopt_long()
Definition at line 52 of file get_options.c.
Referenced by getopt_long().