2010年2月4日

AutoGen AutoOpts example

The AutoGen Home Page
AutoOpts Quick Start
example of the generated getopt_long
/* check.def */
AutoGen Definitions options;

prog_name = check;
prog_title = "Checkout Automated Options";
version = "1.0.0";
copyright = {
date = "2009-2010";
owner = "None";
author = "Solnone";
eaddr = "solnone@gmail.com";
type = lgpl;
};

long_opts;

flag = {
name = check-dirs;
value = L; /* flag style option character */
arg-type = string; /* option argument indication */
max = NOLIMIT; /* occurrence limit (none) */
stack-arg; /* save opt args in a stack */
descrip = "Checkout directory list";
};

flag = {
name = show_defs;
descrip = "Show the definition tree";
disable = dont; /* mark as enable/disable type */
/* option. Disable as 'dont-' */
};

main = {
main-type = shell-process;
};

/*
$ autogen check.def
$ cflags="-DTEST_CHECK_OPTS `autoopts-config cflags`"
$ ldflags="`autoopts-config ldflags`"
$ cc -o check -g ${cflags} check.c ${ldflags}
$ ./check -L/tmp
OPTION_CT=1
export OPTION_CT
CHECK_CHECK_DIRS_CT=1
export CHECK_CHECK_DIRS_CT
CHECK_CHECK_DIRS_1='/tmp'
export CHECK_CHECK_DIRS_1
*/

沒有留言:

網誌存檔