Next: SET_OPT_name - Force an option to be set, Previous: OPT_XLAT_OPT_NAMES - option name xlation, Up: Programmatic Interface [Contents][Index]
If option processing has stopped (either because of an error
or something was encountered that looked like a program argument),
it can be resumed by providing this macro with the index n
of the next option to process and calling optionProcess()
again.
int main(int argc, char ** argv) { for (int ai = 0; ai < argc ;) { restart: ai = optionProcess(&progOptions, argc, argv); for (; ai < argc; ai++) { char * arg = arg[ai]; if (*arg == '-') { RESTART_OPT(ai); goto restart; } process(arg); } } }
If you want a program to operate this way, you might consider specifying a
for-each
main function
(see for-each main procedure) with the interleaved
attribute. It will allow you to process interleaved operands and options from
either the command line or when reading them from standard input.