Support for single-dash long options (as in MH) and negation for boolean options.
* include/mailutils/opt.h (MU_PARSEOPT_SINGLE_DASH) (MU_PARSEOPT_NEGATION): New flags. (mu_parseopt) <po_negation, po_long_opt_start>: New fields. (mu_option_describe_options): Change signature. * libmailutils/opt/help.c (init_usage_vars): Initialize long_opt_col depending on the value of MU_PARSEOPT_SINGLE_DASH bit. (print_option): Handle single-dash long options and boolean options with negations. (option_summary): Likewise. (mu_option_describe_options): Take struct mu_parseopt * as its second parameter. * libmailutils/opt/opt.c (find_long_option): Handle boolean options with negations. Return also a pointer to the mu_option describing the originally used option (as opposed to the canonical one returned by the function). (parse): Handle single-dash long options. (parseopt_init): Initialize po_negation and po_long_opt_start. * libmailutils/tests/parseopt.c (parseopt_param): Handle MU_PARSEOPT_SINGLE_DASH and MU_PARSEOPT_NEGATION.
Showing
4 changed files
with
163 additions
and
57 deletions
-
Please register or sign in to post a comment