#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | option |
The option specifier structure for long options. More... | |
Defines | |
#define | _ABLE_CLIB_GETOPT_H 1 |
#define | no_argument 0 |
long option has no argument | |
#define | required_argument 1 |
long option has a required argument | |
#define | optional_argument 2 |
long option has an optional argument | |
Functions | |
int | getopt_long (int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longindex) |
Process command line options with support for GNU style long options. |
#define _ABLE_CLIB_GETOPT_H 1 |
#define no_argument 0 |
long option has no argument
#define optional_argument 2 |
long option has an optional argument
#define required_argument 1 |
long option has a required argument
int getopt_long | ( | int | argc, | |
char *const * | argv, | |||
const char * | optstring, | |||
const struct option * | longopts, | |||
int * | longindex | |||
) |
Process command line options with support for GNU style long options.
Process the passed string vector an element at a time serching for valid option switches. The short options are processed in a similar way to the getopt function. The long options (ones which begin with a double hypen) are processed acording to the array of long option specifiers.
argc | The number of elements in the argument vector argv. | |
argv | The argument vector. | |
optstring | The short options string. This string is formatted the same as that for getopt. For long options only this must be an empty string not NULL. | |
longopts | An array of option terminated by an option filled with zeros. | |
longindex | Pointer to a variable set to the index of the long option relative to longopts. May be NULL to disable. |