gengetopt - generate a C function which parses command line arguments
gengetopt supports: long and short options (per the GNU Coding Standards), 10 types of parameters (including flag, int, double, string, and function call), and a usage message.
gengetopt itself is under the GPL. The code it generates is not under any license. See LICENSE.
THIS MAN PAGE IS NOT COMPLETE.
Texinfo documentation will be released soon, but meanwhile please refer to README file or to the html documentation that you can find in /usr/share/doc/gengetopt.
-h --help Print help and exit -V --version Print version and exit -iSTRING --input=STRING input file (default std input) -fSTRING --func-name=STRING name of generated function (default='cmdline_parser') -FSTRING --file-name=STRING name of generated file (default='cmdline') -l --long-help long usage line in help -u --unamed-opts accept filenames --no-handle-help do not handle --help|-h automatically --no-handle-version do not handle --version|-V automatically --no-handle-error do not exit on errors
package packname version version purpose purpose option long short desc argtype (default="default val") required option long short desc flag onoff option long short desc no ... # ...
`#' anywhere in a line starts a comment which continues to the end of the line. The data items are as follows:
The third type of option is used to call an arbitrary function. It must not be required. (Otherwise, why is it an option if it doesn't take a parameter?)
Options --help and --version are generated automatically.
Here's an example of a description file:
# file sample1.ggo option "str-opt" s "A string option" string no option "my-opt" m "Another integer option" int no option "int-opt" i "A int option" int yes option "flag-opt" - "A flag option" flag off option "funct-opt" F "A function option" no option "long-opt" - "A long option" long no option "def-opt" - "A string option with default" string default="Hello" no
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |