Opag, which stands for "Option Parser Generator", is a program to generate C or C++ code which parses command line options. It takes as input a description of the command line options you want your program to support. The output is a C or C++ function which finds these options in an array of strings (typically "argv", the second parameter of the "main" function) and sets variables accordingly. Short (single character) as well as long (GNU style) options are supported. It is also possbile to associate a help string with each option. Opag uses these to create a macro which expands to a string containing a nicely formatted description of the options.
| Tags | Software Development Code Generators |
|---|---|
| Licenses | GPL |
| Operating Systems | Unix POSIX |
| Implementation | C |
| Translations | English |
Recent releases


Changes: The preprocessing directives #if, #ifdef, and #endif can be used in the definition section of the input file. They are put around the parsing code for the corresponding options so that code that recognizes some options conditionally can be generated.


Changes: Cleanup of the code and build infrastructure. Reorganization of the directory layout in the source package.


Changes: A typo in the manual page has been fixed.


Changes: Code that can be used in programs with Native Language Support can be generated. No non-ASCII characters appear in code examples in the manual page, even if it is viewed in non-ASCII locales.


Changes: When generating C++ code, exceptions are constructed directly from a ::std::string instead of an intermediate stream object.