diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-10-12 11:30:32 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-10-12 11:30:32 +0300 |
commit | af83aaff0e41587fcdbe78983b6e116e442f17a1 (patch) | |
tree | a758f23c2842b03bd7adbfbc3d2bf9d479ab6032 /include | |
parent | d56b82437f909ff323d9cd87f2ed9f04322f9966 (diff) | |
download | mailutils-af83aaff0e41587fcdbe78983b6e116e442f17a1.tar.gz mailutils-af83aaff0e41587fcdbe78983b6e116e442f17a1.tar.bz2 |
Fix some incompatibilities in the previous commit.
* dotlock/dotlock.c (force): Change type to unsigned.
Provide default value for --force.
(cli): Set exit codes and extra docstring.
* include/mailutils/cli.h (mu_cli_setup): New members: prog_extra_doc,
ex_usage, ex_config.
* include/mailutils/opt.h (mu_parseopt_getcolumn)
(mu_parseopt_fmt_text): New prototypes.
* libmailutils/cli/cli.c (extra_help_hook): New hook.
(mu_cli): Set up customized exit codes.
Pass pointer to struct mu_cli_setup in hints.data.
All uses changed.
Set up help hook if setup->prog_extra_doc is defined.
* libmailutils/opt/help.c (mu_parseopt_getcolumn): New
function.
(print_option_descr): Honor explicit newlines.
(mu_parseopt_fmt_text): New function.
* mimeview/mimeview.c (cli): Provide extra docs.
* sieve/sieve.c: Likewise.
Diffstat (limited to 'include')
-rw-r--r-- | include/mailutils/cli.h | 13 | ||||
-rw-r--r-- | include/mailutils/opt.h | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/include/mailutils/cli.h b/include/mailutils/cli.h index 2943bc469..8f31f7b59 100644 --- a/include/mailutils/cli.h +++ b/include/mailutils/cli.h @@ -39,10 +39,15 @@ void mu_cli_capa_apply (char const *name, mu_list_t opts, mu_list_t commits); struct mu_cli_setup { - struct mu_option **optv; - struct mu_cfg_param *cfg; - char *prog_doc; - char *prog_args; + struct mu_option **optv; /* Command-line options */ + struct mu_cfg_param *cfg; /* Configuration parameters */ + char *prog_doc; /* Program documentation string */ + char *prog_args; /* Program arguments string */ + char *prog_extra_doc; /* Extra documentation. This will be + displayed after options. */ + int ex_usage; /* If not 0, exit code on usage errors */ + int ex_config; /* If not 0, exit code on configuration + errors */ }; void mu_version_func (struct mu_parseopt *po, FILE *stream); diff --git a/include/mailutils/opt.h b/include/mailutils/opt.h index cc5634211..68204b97f 100644 --- a/include/mailutils/opt.h +++ b/include/mailutils/opt.h @@ -168,6 +168,9 @@ void mu_parseopt_error (struct mu_parseopt *po, char const *fmt, ...); int mu_parseopt_apply (struct mu_parseopt *p); void mu_parseopt_free (struct mu_parseopt *p); +unsigned mu_parseopt_getcolumn (const char *name); +void mu_parseopt_fmt_text (const char *text, size_t col); + void mu_option_describe_options (struct mu_option **optbuf, size_t optcnt); void mu_program_help (struct mu_parseopt *p); void mu_program_usage (struct mu_parseopt *p); |