OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
62 #define GETOPT_GENERAL(id, shortname, longname, flags) { id, shortname, flags, longname }
69 #define GETOPT_NOVAL(shortname, longname) GETOPT_GENERAL(shortname, shortname, longname, ODF_NO_VALUE)
76 #define GETOPT_VALUE(shortname, longname) GETOPT_GENERAL(shortname, shortname, longname, ODF_HAS_VALUE)
84 #define GETOPT_OPTVAL(shortname, longname) GETOPT_GENERAL(shortname, shortname, longname, ODF_OPTIONAL_VALUE)
91 #define GETOPT_SHORT_NOVAL(shortname) GETOPT_NOVAL(shortname, nullptr)
97 #define GETOPT_SHORT_VALUE(shortname) GETOPT_VALUE(shortname, nullptr)
104 #define GETOPT_SHORT_OPTVAL(shortname) GETOPT_OPTVAL(shortname, nullptr)
107 #define GETOPT_END() { '\0', '\0', ODF_END, nullptr}
@ ODF_END
Terminator (data is not parsed further).
@ ODF_OPTIONAL_VALUE
An option with an optional value.
const char * longname
Long option name including '-'/'–' prefix, use nullptr if not available.
const OptionData * options
Command line option descriptions.
char ** argv
Remaining command line arguments.
uint16 flags
Option data flags.
char * opt
Option value, if available (else nullptr).
Data storage for parsing command line options.
GetOptData(int argc, char **argv, const OptionData *options)
Constructor of the data store.
byte id
Unique identification of this option data, often the same as shortname.
char shortname
Short option letter if available, else use '\0'.
char * cont
Next call to GetOpt should start here (in the middle of an argument).
OptionDataFlags
Flags of an option.
int GetOpt()
Find the next option.
@ ODF_HAS_VALUE
An option with a value.
@ ODF_NO_VALUE
A plain option (no value attached to it).
int numleft
Number of arguments left in argv.