From 36ce675bb4224a41adafd448f39020e70db14094 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 3 Jul 2007 11:36:43 -0700 Subject: pr -F no longer suppresses the footer or the first two blank header lines Here's a patch along the lines of . It's a bit large since it changes the test cases to match the behavior, and the test cases' file names depend on the behavior! * NEWS: pr -F no longer suppresses the footer or the first two blank lines in the header. * doc/coreutils.texi (pr invocation): Likewise. Also, a too-short page length implies -t, not -T. * src/pr.c (lines_per_header, lines_per_footer): Now constants. (init_parameters): Don't try to change them. (print_header): Use the same header and footer format regardless of wither form feeds are being used. (usage): Adjust to above change when describing too-short page length. Too-short page length impliesy -t, not -T. * tests/pr/2-S_f-t_notab: Adjust to the fact that -F now affects only formfeed handling; it does not change the header. * tests/pr/2-Sf-t_notab: Likewise. ... * tests/pr/3-5l17f-t: Remove, since it's been renamed to another file whose name has a line count 7 larger, reflecting the new line count needed for this behavior. * tests/pr/3a3l8f-t: Likewise. ... * tests/pr/w72l24f-ll: Likewise. Signed-off-by: Jim Meyering --- src/pr.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/pr.c') diff --git a/src/pr.c b/src/pr.c index 0b1aa4606..f52170a42 100644 --- a/src/pr.c +++ b/src/pr.c @@ -536,9 +536,9 @@ static int lines_per_page = 66; /* Number of lines in the header and footer can be reset to 0 using the -t flag. */ -static int lines_per_header = 5; +enum { lines_per_header = 5 }; static int lines_per_body; -static int lines_per_footer = 5; +enum { lines_per_footer = 5 }; /* (-w|-W) Width in characters of the page. Does not include the width of the margin. */ @@ -1214,12 +1214,6 @@ init_parameters (int number_of_files) { int chars_used_by_number = 0; - if (use_form_feed) - { - lines_per_header = 3; - lines_per_footer = 0; - } - lines_per_body = lines_per_page - lines_per_header - lines_per_footer; if (lines_per_body <= 0) { @@ -2395,9 +2389,6 @@ print_header (void) int lhs_spaces; int rhs_spaces; - if (!use_form_feed) - printf ("\n\n"); - output_position = 0; pad_across_to (chars_per_margin); print_white_space (); @@ -2414,7 +2405,7 @@ print_header (void) lhs_spaces = available_width >> 1; rhs_spaces = available_width - lhs_spaces; - printf ("%s%*s%s%*s%s\n\n\n", + printf ("\n\n%s%*s%s%*s%s\n\n\n", date_text, lhs_spaces, " ", file_text, rhs_spaces, " ", page_text); print_a_header = false; @@ -2869,7 +2860,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\ fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\ \n\ --T implied by -l nn when nn <= 10 or <= 3 with -F. With no FILE, or when\n\ +-t is implied if PAGE_LENGTH <= 10. With no FILE, or when\n\ FILE is -, read standard input.\n\ "), stdout); emit_bug_reporting_address (); -- cgit v1.2.3-54-g00ecf