Rewrite parseopt help routines using wordwrap streams
* include/mailutils/stream.h (MU_IOCTL_WORDWRAP_SET_NEXT_MARGIN) (MU_IOCTL_WORDWRAP_GET_OFFSET): New opcodes. * libmailutils/stream/wordwrap.c (_wordwrap_flush_line): Replace whitespace-only lines with single newline on output. (_wordwrap_flush): Fix condition. (set_margin): Bugfix. (_wordwrap_ctl): Handle new opcodes. * include/mailutils/cli.h (mu_version_func): Change signature. * include/mailutils/opt.h (mu_parseopt) <po_help_hook> <po_version_hook>: Change signature. (mu_parseopt_fmt_text): Remove. (mu_option_describe_options, mu_program_help) (mu_program_usage): Change signature. (mu_program_version): New prototype. * libmailutils/cli/cli.c (mu_version_func): Take mu_stream_t as 2nd argument. Use mu_stream_printf for output. (extra_help_hook): Likewise. * libmailutils/opt/help.c: Rewrite using wordwrap streams. * libmailutils/opt/opt.c (fn_help, fn_usage, fn_version): Update. * libmailutils/tests/parseopt.c (version_hook): Write to mu_stream_t. * libmailutils/tests/parseopt_help00.at: Fix expected output. * libmailutils/tests/parseopt_help01.at: Likewise. * libmailutils/tests/parseopt_help02.at: Likewise. * libmailutils/tests/parseopt_help03.at: Likewise. * libmailutils/tests/parseopt_help04.at: Likewise. * libmailutils/tests/parseopt_help05.at: Likewise. * libmailutils/tests/parseopt_help06.at: Likewise. * libmailutils/tests/parseopt_help07.at: Likewise. * libmailutils/tests/parseopt_help08.at: Likewise. * libmailutils/tests/parseopt_help09.at: Likewise. * libmailutils/tests/parseopt_help10.at: Likewise. * libmailutils/tests/parseopt_help11.at: Likewise.
Showing
20 changed files
with
206 additions
and
220 deletions
-
Please register or sign in to post a comment