Simple option processing in form of -xyz
or --loongname
More...
#include <ellipsis-options.h>
Public Member Functions | |
char const * | ellipsis‿options‿argument (ellipsis‿options *p) |
get the argument to the current option character | |
char const * | ellipsis‿options‿current (ellipsis‿options *p) |
get the current command line parameter | |
char | ellipsis‿options‿get (ellipsis‿options *p) |
get the current option character | |
char const * | ellipsis‿options‿longname (ellipsis‿options *p) |
get the long name of the current – option | |
void | ellipsis‿options‿next (ellipsis‿options *p) |
move to the next option character | |
char const * | ellipsis‿options‿progname (ellipsis‿options *p) |
get the program name of this argument list | |
Data Fields | |
char *const *const | argv |
Private Attributes | |
char const *const * | cur |
char | lname [ellipsis‿options‿longname‿max] |
size_t | pos |
Related Symbols | |
(Note that these are not member symbols.) | |
enum | ellipsis‿options‿sizes : size_t |
maximal bytes of a long name handled by ellipsis‿options, including the null terminator More... | |
enum | ellipsis‿options‿specials : char |
symbolic value for an non-option More... | |
Simple option processing in form of -xyz
or --loongname
(If you are not not using ellipsis, use ellipsis‿options instead.)
Note that ellipsis‿options‿argument needs the option character to be the first after the -
, otherwise only a null pointer is retrieved.
Possible option characters are all printable one byte characters (in the sense of isprint
) with the exception of the character -
which has a special meaning. Possible long option names after a --
are sequences of printable characters with exception of the =
character, which starts the argument to the long option.
Command line arguments that are one of -
or --
are special. The first is not an option. It is passed on as such and is retrievable with ellipsis‿options‿current as other non-options. --
changes the state such that all command line arguments coming after it are interpreted as non-options.
Special returns of ellipsis‿options‿get are
--name
or --name=argument
. The argument can be retrieved with ellipsis‿options‿argument; in the first form this is then the next command line argument, in the second the all what is after the =
sign.-
). The parameter itself may be retrieved with ellipsis‿options‿current.0
indicates that all options have been processed.char const * ellipsis‿options‿argument | ( | ellipsis‿options * | p | ) |
get the argument to the current option character
Note that a call to this function marks the current option as having received an argument. Thus this information is then taken into account when passing to the next option character.
References cur, ellipsis‿options‿here, ellipsis‿options‿longoption, ellipsis‿options‿more, ellipsis‿options‿other, ellipsis‿options‿over, and pos.
char const * ellipsis‿options‿current | ( | ellipsis‿options * | p | ) |
get the current command line parameter
this should only be used when the previous call to ellipsis‿options‿get returned ellipsis‿options‿none.
References cur.
char ellipsis‿options‿get | ( | ellipsis‿options * | p | ) |
get the current option character
References argv, cur, ellipsis‿options‿end, ellipsis‿options‿here, ellipsis‿options‿longoption, ellipsis‿options‿more, ellipsis‿options‿none, ellipsis‿options‿other, ellipsis‿options‿start, and pos.
char const * ellipsis‿options‿longname | ( | ellipsis‿options * | p | ) |
get the long name of the current – option
References cur, ellipsis‿options‿get(), ellipsis‿options‿here, ellipsis‿options‿longname‿max, ellipsis‿options‿longoption, ellipsis‿options‿other, lname, and pos.
void ellipsis‿options‿next | ( | ellipsis‿options * | p | ) |
move to the next option character
References cur, ellipsis‿options‿end, ellipsis‿options‿get(), ellipsis‿options‿here, ellipsis‿options‿longoption, ellipsis‿options‿more, ellipsis‿options‿none, ellipsis‿options‿other, ellipsis‿options‿over, ellipsis‿options‿start, and pos.
char const * ellipsis‿options‿progname | ( | ellipsis‿options * | p | ) |
get the program name of this argument list
References argv.
|
related |
maximal bytes of a long name handled by ellipsis‿options, including the null terminator
|
related |
symbolic value for an non-option
Referenced by ellipsis‿options‿get(), and ellipsis‿options‿progname().
|
private |
Referenced by ellipsis‿options‿longname().
|
private |
Referenced by ellipsis‿options‿argument(), ellipsis‿options‿get(), ellipsis‿options‿longname(), and ellipsis‿options‿next().