summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-04-29 19:47:13 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-04-29 19:47:13 +0300
commit44a54b219c95f8d559111595370f278a6bf73d10 (patch)
tree7d08ccf95655949246514de49b1e7d632a5c451d
parent8bda0876ae606be9f5d5a00f15e412bc4186d86c (diff)
downloadmailutils-44a54b219c95f8d559111595370f278a6bf73d10.tar.gz
mailutils-44a54b219c95f8d559111595370f278a6bf73d10.tar.bz2
mh: fix extra doc formatting
* mh/mh_getopt.c (mh_extra_help_hook): Use number of leading whitespace as left margin for output.
-rw-r--r--mh/mh_getopt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/mh/mh_getopt.c b/mh/mh_getopt.c
index a7e0222f5..6a42ca845 100644
--- a/mh/mh_getopt.c
+++ b/mh/mh_getopt.c
@@ -37,7 +37,22 @@ static void
mh_extra_help_hook (struct mu_parseopt *po, mu_stream_t stream)
{
struct getopt_data *data = po->po_data;
- mu_stream_printf (stream, "%s\n", _(data->extra_doc));
+ char const *extra_doc = gettext (data->extra_doc);
+ while (*extra_doc)
+ {
+ size_t len = strcspn (extra_doc, "\n");
+ unsigned margin = strspn (extra_doc, " \t");
+
+ mu_stream_ioctl (stream, MU_IOCTL_WORDWRAPSTREAM,
+ MU_IOCTL_WORDWRAP_SET_MARGIN, &margin);
+ extra_doc += margin;
+ len -= margin;
+ mu_stream_write (stream, extra_doc, len, NULL);
+ mu_stream_write (stream, "\n", 1, NULL);
+ extra_doc += len;
+ if (*extra_doc)
+ extra_doc++;
+ }
}
static void

Return to:

Send suggestions and report system problems to the System administrator.