Simple, stupid and portable C argument (argv) parser.
Just include cargo.h to your project.
CARGO tests are built with CMake for all platforms. You can also use the fake configure script provided to set it up on unix:
$ ./configure
$ make
Depends on Doxygen.
$ make cargo_doc
To handle the following program arguments:
./myprog --flag1 --flag2= --flag3=hello --flag4="Hello world"
You could write this:
[...]
int main(int argc, char* argv[])
{
char* f1 = cargoFlag("flag1", "FALSE", argc, argv); // f1 = "TRUE"
char* f2 = cargoFlag("flag2", "defaultval", argc, argv); // f2 = ""
char* f3 = cargoFlag("flag3", "bye", argc, argv); // f3 = "hello"
char* f4 = cargoFlag("flag4", "Bye world", argc, argv); // f4 = "Hello world"
char* f5 = cargoFlag("flag5", "default", argc, argv); // f5 = "default"
char* f6 = cargoFlag("flag6", "FALSE", argc, argv); // f6 = "FALSE"
[...]