Next: Example option documentation, Previous: Example option help text, Up: Quick Start [Contents][Index]
Normally, however, you would not use the main
clause. Instead,
the file would be named something like checkopt.def, you would
compile checkopt.c the usual way, and link the object with the rest
of your program.
The options are processed by calling optionProcess
(see optionProcess):
main( int argc, char** argv ) { { int optct = optionProcess( &checkOptions, argc, argv ); argc -= optct; argv += optct; }
The options are tested and used as in the following fragment.
ENABLED_OPT
is used instead of HAVE_OPT
for the
--show-defs option because it is an enabled/disabled option type:
if ( ENABLED_OPT( SHOW_DEFS ) && HAVE_OPT( CHECK_DIRS )) { int dirct = STACKCT_OPT( CHECK_DIRS ); char** dirs = STACKLST_OPT( CHECK_DIRS ); while (dirct-- > 0) { char* dir = *dirs++; ...