# Setopt The reverse of getopt. It is standard to create a command from an internal state (object). It is a replacement for usual string concatenation techniques, providing argument order consistency and less bug-prone error handling. ## Docs ### C Implemented as a header only library. #include "setopt.h" /* Struct to define long option - identifier pairs + flags; Straight from getopt */ struct option { const char *name; int has_arg; int *flag; int val; }; int optc, // number of arguments successfuly added reset on each invocation optred, /* not implemented */ opterrno; // non zero if setopt encountered an error must be reset manually char* setopt(const char* optstring, std::unordered_map argv); char* setopt_long(char* optstring, map argv, map argv_long); /* Not implemented */ char* setopt_long_only(char* optstring, map argv_long); /* Not implemented */ **optstring:** Complies with GNU getopt's optstring. That is: *optstring is a string containing the legitimate option characters. A legitimate option character is any visible one byte ascii(7) character (for which isgraph(3) would return nonzero) that is not '-', ':', or ';'. If such a character is followed by a colon, the option requires an argument [...] Two colons mean an option takes an optional arg [...]*