argp: fix handling of very long options in --help

* lib/argp-help.c (hol_entry_help): Handle cases with option
description is larger than RMARGIN.
This commit is contained in:
Alexandre Duret-Lutz 2020-07-28 10:30:45 +02:00
parent 31fd31436a
commit a804f964d2

View file

@ -1186,7 +1186,11 @@ hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
__argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col);
__argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col);
if (col > (unsigned int) (uparams.opt_doc_col + 3))
/* Put the description on a new line if it cannot start
within 3 columns of OPT_DOC_COL. Note that if the option
specification went past RMARGIN, then COL has been reset
to 0. */
if (col > (unsigned int) (uparams.opt_doc_col + 3) || col == 0)
__argp_fmtstream_putc (stream, '\n');
else if (col >= (unsigned int) uparams.opt_doc_col)
__argp_fmtstream_puts (stream, " ");