struct option; typedefint parse_opt_cb(conststruct option *, constchar *arg, int unset);
/* * `type`:: * holds the type of the option, you must have an OPTION_END last in your * array. * * `short_name`:: * the character to use as a short option name, '\0' if none. * * `long_name`:: * the long option name, without the leading dashes, NULL if none. * * `value`:: * stores pointers to the values to be filled. * * `argh`:: * token to explain the kind of argument this option wants. Keep it * homogeneous across the repository. * * `help`:: * the short help associated to what the option does. * Must never be NULL (except for OPTION_END). * OPTION_GROUP uses this pointer to store the group header. * * `flags`:: * mask of parse_opt_option_flags. * PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs) * PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs * PARSE_OPT_NONEG: says that this option cannot be negated * PARSE_OPT_HIDDEN this option is skipped in the default usage, showed in * the long one. * * `callback`:: * pointer to the callback to use for OPTION_CALLBACK. * * `defval`:: * default value to fill (*->value) with for PARSE_OPT_OPTARG. * OPTION_{BIT,SET_UINT,SET_PTR} store the {mask,integer,pointer} to put in * the value when met. * CALLBACKS can use it like they want. * * `set`:: * whether an option was set by the user
*/ struct option { enum parse_opt_type type; int short_name; constchar *long_name; void *value; constchar *argh; constchar *help; constchar *build_opt;
/* parse_options() will filter out the processed options and leave the * non-option argments in argv[]. * Returns the number of arguments left in argv[]. * * NOTE: parse_options() and parse_options_subcommand() may call exit() in the * case of an error (or for 'special' options like --list-cmds or --list-opts).
*/ externint parse_options(int argc, constchar **argv, conststruct option *options, constchar * const usagestr[], int flags);
/* * It's okay for the caller to consume argv/argc in the usual way. * Other fields of that structure are private to parse-options and should not * be modified in any way.
*/ struct parse_opt_ctx_t { constchar **argv; constchar **out; int argc, cpidx; constchar *opt; conststruct option *excl_opt; int flags;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.