summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-10-16 00:44:30 +0300
committerSergey Poznyakoff <gray@gnu.org>2016-10-16 00:55:09 +0300
commitee71e7712297f5e2ca6ed38fce4a0fc1e72ca5d0 (patch)
tree3ae2e8c37668fb8a7d2b4bab1c4fa43da675d4db /include
parent2a28ab58762f9ae9cd00ca3e467ee6f90f241201 (diff)
downloadmailutils-ee71e7712297f5e2ca6ed38fce4a0fc1e72ca5d0.tar.gz
mailutils-ee71e7712297f5e2ca6ed38fce4a0fc1e72ca5d0.tar.bz2
Allow for multiple argument sets in help output.
Alternative invocations follow the main one, each on a separate line, preceded by " or: ". * include/mailutils/cli.h (mu_cli_setup) <prog_alt_args>: New member. * include/mailutils/opt.h (mu_parseopt) <po_prog_args>: Change type. (mu_program_usage): Change signature. * include/mailutils/stream.h (MU_IOCTL_WORDWRAP_GET_OFFSET): Rename to MU_IOCTL_WORDWRAP_GET_COLUMN. All uses changed. * libmailutils/cli/cli.c (mu_cli): Construct po.po_prog_args from prog_args and prog_alt_args. * libmailutils/opt/help.c (move_margin): Remove. (print_program_usage): New static function. (mu_program_usage): Second argument instructs how to display options. Main work is done by print_program_usage. (mu_program_help): Call print_program_usage. * libmailutils/opt/opt.c: Update. * libmailutils/stream/wordwrap.c (set_margin): Avoid unnecessary flushes. * libmailutils/tests/parseopt.c (MU_PARSEOPT_PROG_ARGS): Alternative argument sets are separated by the pipe sign. * libmailutils/tests/Makefile.am: Add new testcase. * libmailutils/tests/testsuite.at: Likewise. * libmailutils/tests/parseopt_help04.at: Add MU_PARSEOPT_PROG_ARGS to keywords. * libmailutils/tests/parseopt_help12.at: New file. * libmailutils/tests/tcli.c (cli): Add alternative arguments. * dotlock/dotlock.c: Update. * mimeview/mimeview.c: Likewise. * sieve/sieve.c: Likewise.
Diffstat (limited to 'include')
-rw-r--r--include/mailutils/cli.h1
-rw-r--r--include/mailutils/opt.h4
-rw-r--r--include/mailutils/stream.h9
3 files changed, 10 insertions, 4 deletions
diff --git a/include/mailutils/cli.h b/include/mailutils/cli.h
index 097759e9d..dec27def8 100644
--- a/include/mailutils/cli.h
+++ b/include/mailutils/cli.h
@@ -43,6 +43,7 @@ struct mu_cli_setup
struct mu_cfg_param *cfg; /* Configuration parameters */
char *prog_doc; /* Program documentation string */
char *prog_args; /* Program arguments string */
+ char const **prog_alt_args; /* Alternative 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 */
diff --git a/include/mailutils/opt.h b/include/mailutils/opt.h
index 775211712..87a983937 100644
--- a/include/mailutils/opt.h
+++ b/include/mailutils/opt.h
@@ -125,7 +125,7 @@ struct mu_parseopt
/* Informational: */
char const *po_prog_name;
char const *po_prog_doc;
- char const *po_prog_args;
+ char const **po_prog_args;
char const *po_bug_address;
char const *po_package_name;
char const *po_package_url;
@@ -172,7 +172,7 @@ unsigned mu_parseopt_getcolumn (const char *name);
void mu_option_describe_options (mu_stream_t str,
struct mu_option **optbuf, size_t optcnt);
void mu_program_help (struct mu_parseopt *p, mu_stream_t str);
-void mu_program_usage (struct mu_parseopt *p, mu_stream_t str);
+void mu_program_usage (struct mu_parseopt *p, int optsummary, mu_stream_t str);
void mu_program_version (struct mu_parseopt *po, mu_stream_t str);
void mu_option_set_value (struct mu_parseopt *po, struct mu_option *opt,
diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h
index 4f0ef69cf..dbd9262e9 100644
--- a/include/mailutils/stream.h
+++ b/include/mailutils/stream.h
@@ -208,11 +208,16 @@ enum mu_buffer_type
((n) == MU_TRANSPORT_INPUT || (n) == MU_TRANSPORT_OUTPUT)
/* Word wrapper streams */
+/* Get left margin. */
#define MU_IOCTL_WORDWRAP_GET_MARGIN 0
-#define MU_IOCTL_WORDWRAP_SET_MARGIN 1
+/* Set left margin */
+#define MU_IOCTL_WORDWRAP_SET_MARGIN 1
+/* Shift left margin relative to current position */
#define MU_IOCTL_WORDWRAP_MOVE_MARGIN 2
+/* Set left margin for the next line */
#define MU_IOCTL_WORDWRAP_SET_NEXT_MARGIN 3
-#define MU_IOCTL_WORDWRAP_GET_OFFSET 4
+/* Get current column */
+#define MU_IOCTL_WORDWRAP_GET_COLUMN 4
struct mu_nullstream_pattern
{

Return to:

Send suggestions and report system problems to the System administrator.