diff options
author | Jim Meyering <meyering@redhat.com> | 2009-03-06 20:03:26 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-03-07 23:52:08 +0100 |
commit | a4053c5291d5797734b3e4f042f9e1adf3944fd6 (patch) | |
tree | c9d69875fa146021d6dfbfab798a4460c9701477 | |
parent | 85507b24f9531b20c339acbf6c215c84e74b6860 (diff) | |
download | coreutils-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.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | src/pr.c | 6 | ||||
-rw-r--r-- | tests/pr/W20l24f-ll | 18 | ||||
-rw-r--r-- | tests/pr/o3Jml24f-lm-lo | 18 | ||||
-rw-r--r-- | tests/pr/o3a3Sl24f-tn | 4 | ||||
-rw-r--r-- | tests/pr/o3a3Snl24f-tn | 4 | ||||
-rw-r--r-- | tests/pr/o3a3l24f-tn | 4 | ||||
-rw-r--r-- | tests/pr/o3b3Sl24f-tn | 4 | ||||
-rw-r--r-- | tests/pr/o3b3Snl24f-tn | 4 | ||||
-rw-r--r-- | tests/pr/o3b3l24f-tn | 4 | ||||
-rw-r--r-- | tests/pr/o3mSl24f-bl-tn | 20 | ||||
-rw-r--r-- | tests/pr/o3mSnl24fbltn | 20 | ||||
-rw-r--r-- | tests/pr/o3ml24f-bl-tn | 20 |
14 files changed, 68 insertions, 62 deletions
@@ -9,6 +9,9 @@ GNU coreutils NEWS -*- outline -*- The bug strikes only with both --recursive (-r, -R) and --link (-l). [bug introduced in coreutils-7.1] + pr: fix the bug whereby --indent=N (-o) did not indent header lines + [bug introduced in coreutils-6.9.90] + sort now handles specified key ends correctly. Previously -k1,1b would have caused leading space from field 2 to be included in the sort while -k2,3.0 would have not included field 3. @@ -89,6 +89,7 @@ Brian Youmans 3diff@gnu.org Bruce Korb bkorb@veritas.com Bruce Robertson brucer@theodolite.dyndns.org Bruno Haible haible@clisp.cons.org +C de-Avillez hggdh2@gmail.com Carl Johnson carlj@cjlinux.home.org Carl Lowenstein cdl@mpl.UCSD.EDU Carl Roth roth@urs.us @@ -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; diff --git a/tests/pr/W20l24f-ll b/tests/pr/W20l24f-ll index ecc9a7afc..92d08afe4 100644 --- a/tests/pr/W20l24f-ll +++ b/tests/pr/W20l24f-ll @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 +-- Date/Time --xPage 1 1<<< -Test: FF's in @@ -19,13 +19,13 @@ 14<<< 123456789 123 --- Date/Time -- x Page 2 +-- Date/Time --xPage 2 --- Date/Time -- x Page 3 +-- Date/Time --xPage 3 15<<< xyzxyzxyz XYZ @@ -44,13 +44,13 @@ 28<<< trunc --- Date/Time -- x Page 4 +-- Date/Time --xPage 4 --- Date/Time -- x Page 5 +-- Date/Time --xPage 5 29<<<xyzxyzxyz XYZXY @@ -69,19 +69,19 @@ 42<<< 123456789 abc --- Date/Time -- x Page 6 +-- Date/Time --xPage 6 --- Date/Time -- x Page 7 +-- Date/Time --xPage 7 --- Date/Time -- x Page 8 +-- Date/Time --xPage 8 43<<< xyzxyzxyz XYZ @@ -100,7 +100,7 @@ 56<<< 123456789 abc --- Date/Time -- x Page 9 +-- Date/Time --xPage 9 57<<< xyzxyzxyz XYZ diff --git a/tests/pr/o3Jml24f-lm-lo b/tests/pr/o3Jml24f-lm-lo index a14183566..e0aa4a48c 100644 --- a/tests/pr/o3Jml24f-lm-lo +++ b/tests/pr/o3Jml24f-lm-lo @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1<<< -Test: FF's in Text >>> 1::: Test-INPUT: "Without FF set by Hand" ::: @@ -19,7 +19,7 @@ 14<<< 123456789 123456789 123456789 >>> 14::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 ::: --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 15::: xyzxyzxyz XYZXYZXYZ abcabcab ::: @@ -38,7 +38,7 @@ 28::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 ::: --- Date/Time -- x Page 3 + -- Date/Time -- x Page 3 15<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> 29::: xyzxyzxyz XYZXYZXYZ abcabcab ::: @@ -57,7 +57,7 @@ 28<<< trunc 42::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 ::: --- Date/Time -- x Page 4 + -- Date/Time -- x Page 4 43::: xyzxyzxyz XYZXYZXYZ abcabcab ::: @@ -76,7 +76,7 @@ 56::: 89 123456789 123456789 123456789 123456789 123456789 123456789 1234567890 ::: --- Date/Time -- x Page 5 + -- Date/Time -- x Page 5 29<<<xyzxyzxyz XYZXYZXYZ abcabcab >>> 57::: xyzxyzxyz XYZXYZXYZ abcabcab ::: @@ -95,19 +95,19 @@ 42<<< 123456789 abcdefghi ABCDEDFHI >>> --- Date/Time -- x Page 6 + -- Date/Time -- x Page 6 --- Date/Time -- x Page 7 + -- Date/Time -- x Page 7 --- Date/Time -- x Page 8 + -- Date/Time -- x Page 8 43<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> @@ -126,7 +126,7 @@ 56<<< 123456789 abcdefghi ABCDEDFHI >>> --- Date/Time -- x Page 9 + -- Date/Time -- x Page 9 57<<< xyzxyzxyz XYZXYZXYZ abcabcab >>> diff --git a/tests/pr/o3a3Sl24f-tn b/tests/pr/o3a3Sl24f-tn index 8986aea3a..0064f2fb9 100644 --- a/tests/pr/o3a3Sl24f-tn +++ b/tests/pr/o3a3Sl24f-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1 Test-INPUT: "With:--:2 Options -b -3 [+2:--:3 Options -a -3 [+2 @@ -19,7 +19,7 @@ 40 DEFGHI 123456789 :--:41 yzxyzxyz XYZXYZXYZ:--:42 456789 123456789 a --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 43 xyzxyzxyz XYZXYZXY:--:44 456789 123456789 x:--:5 diff --git a/tests/pr/o3a3Snl24f-tn b/tests/pr/o3a3Snl24f-tn index 2560cec2d..5a8f2636b 100644 --- a/tests/pr/o3a3Snl24f-tn +++ b/tests/pr/o3a3Snl24f-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1.1 Test-INPUT::--: 2.2 Options -b :--: 3.3 Options -a @@ -19,7 +19,7 @@ 40.40 DEFGHI 12345:--: 41.41 yzxyzxyz XYZ:--: 42.42 456789 12345 --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 43.43 xyzxyzxyz XY:--: 44.44 456789 12345:--: 45.5 diff --git a/tests/pr/o3a3l24f-tn b/tests/pr/o3a3l24f-tn index b2d8a4268..9adbe67ab 100644 --- a/tests/pr/o3a3l24f-tn +++ b/tests/pr/o3a3l24f-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1 Test-INPUT: "Withou 2 Options -b -3 [+2|+ 3 Options -a -3 [+2|+ @@ -19,7 +19,7 @@ 40 DEFGHI 123456789 41 yzxyzxyz XYZXYZXYZ a 42 456789 123456789 abc --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 43 xyzxyzxyz XYZXYZXYZ 44 456789 123456789 xyz 5 diff --git a/tests/pr/o3b3Sl24f-tn b/tests/pr/o3b3Sl24f-tn index 6294d9108..2e119839a 100644 --- a/tests/pr/o3b3Sl24f-tn +++ b/tests/pr/o3b3Sl24f-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1 Test-INPUT: "With:--:15 xyzxyzxyz XYZXYZXY:--:29 xyzxyzxyz XYZXYZXY @@ -19,7 +19,7 @@ 14 456789 123456789 1:--:28 no trunc :--:42 456789 123456789 a --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 43 xyzxyzxyz XYZXYZXY:--:50 :--:57 xyzxyzxyz XYZXYZXY diff --git a/tests/pr/o3b3Snl24f-tn b/tests/pr/o3b3Snl24f-tn index 200b78092..1b945fe92 100644 --- a/tests/pr/o3b3Snl24f-tn +++ b/tests/pr/o3b3Snl24f-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1.1 Test-INPUT::--: 15.15 xyzxyzxyz XY:--: 29.29 xyzxyzxyz XY @@ -19,7 +19,7 @@ 14.14 456789 12345:--: 28.28 no trunc :--: 42.42 456789 12345 --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 43.43 xyzxyzxyz XY:--: 50.50 :--: 57.57 xyzxyzxyz XY diff --git a/tests/pr/o3b3l24f-tn b/tests/pr/o3b3l24f-tn index 73309b65d..0d237bbd5 100644 --- a/tests/pr/o3b3l24f-tn +++ b/tests/pr/o3b3l24f-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1 Test-INPUT: "Withou 15 xyzxyzxyz XYZXYZXYZ 29 xyzxyzxyz XYZXYZXYZ @@ -19,7 +19,7 @@ 14 456789 123456789 123 28 no trunc 42 456789 123456789 abc --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 43 xyzxyzxyz XYZXYZXYZ 50 57 xyzxyzxyz XYZXYZXYZ diff --git a/tests/pr/o3mSl24f-bl-tn b/tests/pr/o3mSl24f-bl-tn index adac88ec2..c90a2b446 100644 --- a/tests/pr/o3mSl24f-bl-tn +++ b/tests/pr/o3mSl24f-bl-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1 FF-Test: FF's in Text :--:1 Test-INPUT: "Without FF set by @@ -19,7 +19,7 @@ 14 456789 123456789 123456789 1234:--:14 456789 123456789 123456789 1234 --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 :--:15 xyzxyzxyz XYZXYZXYZ abcabcab @@ -38,7 +38,7 @@ :--:28 no trunc --- Date/Time -- x Page 3 + -- Date/Time -- x Page 3 15 xyzxyzxyz XYZXYZXYZ abcabcab :--:29 xyzxyzxyz XYZXYZXYZ abcabcab @@ -57,7 +57,7 @@ :--:42 456789 123456789 abcdefghi ABCD --- Date/Time -- x Page 4 + -- Date/Time -- x Page 4 :--:43 xyzxyzxyz XYZXYZXYZ abcabcab @@ -76,7 +76,7 @@ :--:56 456789 123456789 abcdefghi ABCD --- Date/Time -- x Page 5 + -- Date/Time -- x Page 5 29 xyzxyzxyz XYZXYZXYZ abcabcab :--:57 xyzxyzxyz XYZXYZXYZ abcabcab @@ -95,19 +95,19 @@ 42 456789 123456789 abcdefghi ABCD --- Date/Time -- x Page 6 + -- Date/Time -- x Page 6 --- Date/Time -- x Page 7 + -- Date/Time -- x Page 7 --- Date/Time -- x Page 8 + -- Date/Time -- x Page 8 43 xyzxyzxyz XYZXYZXYZ abcabcab :--: @@ -126,7 +126,7 @@ 56 456789 123456789 abcdefghi ABCD --- Date/Time -- x Page 9 + -- Date/Time -- x Page 9 :--: @@ -145,7 +145,7 @@ 70 456789 123456789 abcdefghi ABC:--: --- Date/Time -- x Page 10 + -- Date/Time -- x Page 10 1 :--: diff --git a/tests/pr/o3mSnl24fbltn b/tests/pr/o3mSnl24fbltn index 7243641b1..655b56f65 100644 --- a/tests/pr/o3mSnl24fbltn +++ b/tests/pr/o3mSnl24fbltn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1.1 FF-Test: FF's in Text :--:1 Test-INPUT: "Without FF set @@ -19,7 +19,7 @@ 14.14 456789 123456789 123456789 1:--:14 456789 123456789 123456789 1 --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 15. :--:15 xyzxyzxyz XYZXYZXYZ abcabcab @@ -38,7 +38,7 @@ 28. :--:28 no trunc --- Date/Time -- x Page 3 + -- Date/Time -- x Page 3 29.15 xyzxyzxyz XYZXYZXYZ abcabcab:--:29 xyzxyzxyz XYZXYZXYZ abcabcab @@ -57,7 +57,7 @@ 42. :--:42 456789 123456789 abcdefghi A --- Date/Time -- x Page 4 + -- Date/Time -- x Page 4 43. :--:43 xyzxyzxyz XYZXYZXYZ abcabcab @@ -76,7 +76,7 @@ 56. :--:56 456789 123456789 abcdefghi A --- Date/Time -- x Page 5 + -- Date/Time -- x Page 5 57.29 xyzxyzxyz XYZXYZXYZ abcabcab:--:57 xyzxyzxyz XYZXYZXYZ abcabcab @@ -95,19 +95,19 @@ 70.42 456789 123456789 abcdefghi A --- Date/Time -- x Page 6 + -- Date/Time -- x Page 6 --- Date/Time -- x Page 7 + -- Date/Time -- x Page 7 --- Date/Time -- x Page 8 + -- Date/Time -- x Page 8 71.43 xyzxyzxyz XYZXYZXYZ abcabcab:--: @@ -126,7 +126,7 @@ 84.56 456789 123456789 abcdefghi A --- Date/Time -- x Page 9 + -- Date/Time -- x Page 9 85. :--: @@ -145,7 +145,7 @@ 98.70 456789 123456789 abcdefghi :--: --- Date/Time -- x Page 10 + -- Date/Time -- x Page 10 99.1 :--: diff --git a/tests/pr/o3ml24f-bl-tn b/tests/pr/o3ml24f-bl-tn index a2b7be52d..5109be0a0 100644 --- a/tests/pr/o3ml24f-bl-tn +++ b/tests/pr/o3ml24f-bl-tn @@ -1,6 +1,6 @@ --- Date/Time -- x Page 1 + -- Date/Time -- x Page 1 1 FF-Test: FF's in Text 1 Test-INPUT: "Without FF set by @@ -19,7 +19,7 @@ 14 456789 123456789 123456789 12345 14 456789 123456789 123456789 12345 --- Date/Time -- x Page 2 + -- Date/Time -- x Page 2 15 xyzxyzxyz XYZXYZXYZ abcabcab @@ -38,7 +38,7 @@ 28 no trunc --- Date/Time -- x Page 3 + -- Date/Time -- x Page 3 15 xyzxyzxyz XYZXYZXYZ abcabcab 29 xyzxyzxyz XYZXYZXYZ abcabcab @@ -57,7 +57,7 @@ 42 456789 123456789 abcdefghi ABCDE --- Date/Time -- x Page 4 + -- Date/Time -- x Page 4 43 xyzxyzxyz XYZXYZXYZ abcabcab @@ -76,7 +76,7 @@ 56 456789 123456789 abcdefghi ABCDE --- Date/Time -- x Page 5 + -- Date/Time -- x Page 5 29 xyzxyzxyz XYZXYZXYZ abcabcab 57 xyzxyzxyz XYZXYZXYZ abcabcab @@ -95,19 +95,19 @@ 42 456789 123456789 abcdefghi ABCDE --- Date/Time -- x Page 6 + -- Date/Time -- x Page 6 --- Date/Time -- x Page 7 + -- Date/Time -- x Page 7 --- Date/Time -- x Page 8 + -- Date/Time -- x Page 8 43 xyzxyzxyz XYZXYZXYZ abcabcab @@ -126,7 +126,7 @@ 56 456789 123456789 abcdefghi ABCDE --- Date/Time -- x Page 9 + -- Date/Time -- x Page 9 @@ -145,7 +145,7 @@ 70 456789 123456789 abcdefghi ABCD --- Date/Time -- x Page 10 + -- Date/Time -- x Page 10 1 |