btrfs-progs: help: indent option description newlines

A newline character in option description text will break line and then
indent the text properly, can be used for lists or paragraphs.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-07-14 13:59:07 +02:00
parent 3d17609d66
commit c135550c28
1 changed files with 3 additions and 1 deletions

View File

@ -156,11 +156,13 @@ static void format_text(const char *line, FILE *outf)
while (*line && *line == ' ')
line++;
while (*line && *line != ' ') {
if (*line == '\n')
break;
fputc(*line, outf);
line++;
i++;
}
if (i > HELPINFO_DESC_WIDTH) {
if (i > HELPINFO_DESC_WIDTH || (*line == '\n')) {
if (*line) {
fputc('\n', outf);
line++;