Thursday, December 09, 2004

gengetopt

http://www.gnu.org/software/gengetopt/gengetopt.html
If an option is given multiple times

If an option is specified as multiple, then it can be specified multiple times at command line. In this case, say the option is called foo, the generated foo_given field in the args structure contains the number of times it was specified and the generated field foo_arg is an array containing all the values that were specified for this option.

Notice that if a default value is specified for a multiple option, that value is assigned to the option only if no other value is specified on the command line (and the corresponding _given field will be set to 1), i.e., a default value IS NOT always part of the values of a multiple option.

for (i = 0; i < args_info.string_given; ++i)

printf ("passed string: %s\n", args_info.string_arg[i]);


No comments: