GetOptList

This function is similar to the POSIX function getopt. All options and their corresponding arguments are returned in a linked list. This function should only be called once per an option list and it does not modify argv or argc.

extern (C) pure nothrow @trusted @nogc
GetOptList
(
const int argc
,
scope const char** argv
,
scope const char* options
)

Parameters

argc int

the number of command line arguments (including the name of the executable)

argv char**

pointer to the open binary file to write encoded output

options char*

getopt style option list. A null terminated string of single character options. Follow an option with a colon to indicate that it requires an argument.

Effects: Creates a link list of command line options and their arguments.

NOTE: The caller is responsible for freeing up the option list when it is no longer needed.

Return Value

Type: .option_t*

option_t type value where the option and arguement fields contain the next option symbol and its argument (if any). The argument field will be set to null if there are no arguments or if you specify an option with missing arguments or if memory allocation fails. The option field will be set to PO_NO_OPT if no more options are found.

Meta