1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-05 13:18:20 +03:00

man: break long lines that would wrap

When all the required command line elements would go
beyond 80 chars and wrap to a new line, insert a line
break and indent, and continue the required elements
on a second line.
This commit is contained in:
David Teigland 2017-02-08 16:52:26 -06:00
parent e43203f64c
commit 5e7d9d4b92

View File

@ -1856,6 +1856,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
struct command_name *cname;
int onereq = (cmd->cmd_flags & CMD_FLAG_ONE_REQUIRED_OPT) ? 1 : 0;
int i, sep, ro, rp, oo, op, opt_enum;
int need_ro_indent_end = 0;
if (!(cname = find_command_name(cmd->name)))
return;
@ -1910,7 +1911,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
print_def_man(&cmd->required_opt_args[ro].def, 1);
}
sep = 1;
sep++;
}
/* print required options without a short opt */
@ -1934,7 +1935,7 @@ void print_man_usage(char *lvmname, struct command *cmd)
print_def_man(&cmd->required_opt_args[ro].def, 1);
}
sep = 1;
sep++;
}
printf(" )\n");
@ -1968,7 +1969,16 @@ void print_man_usage(char *lvmname, struct command *cmd)
*/
if (cmd->ro_count) {
sep = 0;
for (ro = 0; ro < cmd->ro_count; ro++) {
/* avoid long line wrapping */
if ((cmd->ro_count > 2) && (sep == 2)) {
printf("\n.RS 5\n");
need_ro_indent_end = 1;
}
opt_enum = cmd->required_opt_args[ro].opt;
if (opt_names[opt_enum].short_opt) {
@ -1983,6 +1993,8 @@ void print_man_usage(char *lvmname, struct command *cmd)
printf(" ");
print_def_man(&cmd->required_opt_args[ro].def, 1);
}
sep++;
}
}
@ -2000,6 +2012,9 @@ void print_man_usage(char *lvmname, struct command *cmd)
printf("\n");
}
if (need_ro_indent_end)
printf(".RE\n");
printf(".br\n");
oo_count: