summaryrefslogtreecommitdiff
path: root/src/pr.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-03-06 20:03:26 +0100
committerJim Meyering <meyering@redhat.com>2009-03-07 23:52:08 +0100
commita4053c5291d5797734b3e4f042f9e1adf3944fd6 (patch)
treec9d69875fa146021d6dfbfab798a4460c9701477 /src/pr.c
parent85507b24f9531b20c339acbf6c215c84e74b6860 (diff)
downloadcoreutils-a4053c5291d5797734b3e4f042f9e1adf3944fd6.tar.xz
pr: fix a bug whereby --indent=N (-o) did not indent header lines
* src/pr.c (print_header): Honor chars_per_margin also for the header. Inspired by a patch from C de-Avillez. This change also adjusts two other %*s directives to be %*.*s instead, (for the padding on either side of "file_text") to correct a bug that could make pr print one space of padding instead of none. * NEWS (Bug fixes): Mention it. * tests/pr/o3Jml24f-lm-lo: Adjust for new expected output. * tests/pr/o3a3Sl24f-tn: Likewise. * tests/pr/o3a3Snl24f-tn: Likewise. * tests/pr/o3a3l24f-tn: Likewise. * tests/pr/o3b3Sl24f-tn: Likewise. * tests/pr/o3b3Snl24f-tn: Likewise. * tests/pr/o3b3l24f-tn: Likewise. * tests/pr/o3mSl24f-bl-tn: Likewise. * tests/pr/o3mSnl24fbltn: Likewise. * tests/pr/o3ml24f-bl-tn: Likewise.
Diffstat (limited to 'src/pr.c')
-rw-r--r--src/pr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pr.c b/src/pr.c
index 0c02430e3..3b6e8015e 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -2402,8 +2402,10 @@ print_header (void)
lhs_spaces = available_width >> 1;
rhs_spaces = available_width - lhs_spaces;
- printf ("\n\n%s%*s%s%*s%s\n\n\n",
- date_text, lhs_spaces, " ", file_text, rhs_spaces, " ", page_text);
+ printf ("\n\n%*.*s%s%*.*s%s%*.*s%s\n\n\n",
+ chars_per_margin, chars_per_margin, " ",
+ date_text, lhs_spaces, lhs_spaces, " ",
+ file_text, rhs_spaces, rhs_spaces, " ", page_text);
print_a_header = false;
output_position = 0;