[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #28492] pr header lacks spaces around long file names
From: |
anonymous |
Subject: |
[bug #28492] pr header lacks spaces around long file names |
Date: |
Wed, 06 Jan 2010 00:53:35 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.3) Gecko/20090909 Fedora/3.5.3-1.fc11 Firefox/3.5.3 |
URL:
<http://savannah.gnu.org/bugs/?28492>
Summary: pr header lacks spaces around long file names
Project: GNU Core Utilities
Submitted by: None
Submitted on: Wed 06 Jan 2010 12:53:34 AM UTC
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Printing a file whose path or name is longer than 48 chars
leaves the file name adjoining the <date> and/or <page>
elements of the header.
Names shorter than 48 chars are centered between spaces in
the available width.
Names longer than 48 chars lack padding spaces.
Names longer than 50 chars appear without spaces in a wider format header.
Repeat by:
base='123456789_123456789_123456789_123456789_1234567'
longs=$( echo ${base}{8,89,89_,89_1} )
for f in ${longs} ; do echo >> $f; done
pr ${longs} | cat -s
produces (modulo date formats and 'Page' translation):
2010-01-05 16:48 123456789_123456789_123456789_123456789_12345678 Page 1
2010-01-05 16:48123456789_123456789_123456789_123456789_123456789 Page 1
2010-01-05 16:48123456789_123456789_123456789_123456789_123456789_Page 1
2010-01-05 16:48123456789_123456789_123456789_123456789_123456789_1Page 1
POSIX appears to specify a printf format for pr headers equivalent to:
"\n\n%s %s Page %d\n\n\n",
<output of date>, <file>, <page number>
which shows explicit spaces around the file name field.
I added statements to pr.c to coerce the spacing to be greater than 0,
but there may certainly be a more elegant approach that considers
the issues of headers for multiple columns.
--- pr.c 2010-01-05 16:27:54.000000000 -0800
+++ pr.orig.c 2010-01-05 15:10:50.000000000 -0800
@@ -2403,9 +2403,6 @@
lhs_spaces = available_width >> 1;
rhs_spaces = available_width - lhs_spaces;
- lhs_spaces = lhs_spaces > 0 ? lhs_spaces : 1;
- rhs_spaces = rhs_spaces > 0 ? rhs_spaces : 1;
-
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);
--
I am entitled to copyright of this bug report and patch, but
disclaim any such interest, and place them in the public domain,
with the intent that GNU/FSF may use them as they please.
best wishes,
Denis McKeon
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?28492>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #28492] pr header lacks spaces around long file names,
anonymous <=