bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fw: pr and indentation -- proposed patch


From: hggdh
Subject: Fw: pr and indentation -- proposed patch
Date: Thu, 5 Mar 2009 16:11:10 -0600

Hello,

I sent the email below sometime ago; since there was no response, I
decided to propose a patch in order to have the title line also indented
by --indent.

Regards,

..hggdh..

diff --git a/src/pr.c b/src/pr.c
index 308a025..331762f 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -2399,13 +2399,13 @@ print_header (void)
      "Page %"PRIuMAX does not generate more than (sizeof page_text - 1)
      bytes.  */
   sprintf (page_text, _("Page %"PRIuMAX), page_number++);
-  available_width = header_width_available - mbswidth (page_text, 0);
+  available_width = header_width_available - (chars_per_margin + mbswidth 
(page_text, 0));
   available_width = MAX (0, available_width);
   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, " ", date_text, lhs_spaces, " ", file_text, 
rhs_spaces, " ", page_text);
 
   print_a_header = false;
   output_position = 0;


Begin forwarded message:

Date: Thu, 19 Feb 2009 22:17:48 -0600
From: hggdh <address@hidden>
To: Coreutils <address@hidden>
Subject: pr and indentation


Original Ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/331817

----original bug description----

While the pr command recognizes the --indent (-o) option, page headers
are printed without indentation.

Expected results (for example, version 5.2.1 from CentOS 4):
$ ls /usr/bin | pr --indent 5 | head

     2009-02-19 17:43 Page 1

     [
     4odb
     4rdf
     4ss
     4ssd

Actual results (in 8.04/ pr version 6.10):
$ ls /usr/bin | pr --indent 5 | head

2009-02-19 17:45 Page 1

     [
     411toppm
     a2p
     a2ps
     a2ps-lpr-wrapper

----original bug description----

I have tested with git 'pr', and the same happens:

address@hidden:/usr/src/buildd/libpst/libpst-0.6.25 $ ls /usr/bin | pr
--indent 5 | head 

2009-02-19 22:08                                                  Page 1


     [
     2to3-2.6
     2to3-3.0
     404main
     411toppm
address@hidden:/usr/src/buildd/libpst/libpst-0.6.25 $ pr --version
pr (GNU coreutils) 7.0.188-0e40e-dirty

Although it is not clear what would be the expected behaviour, it seems
intuitive that if --indent is provided, all output should be indented.

Regards,

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]