NetBSD Problem Report #5797

Received: (qmail 19756 invoked from network); 19 Jul 1998 17:34:48 -0000
Message-Id: <199807191734.NAA19351@nc1.home.duh.org>
Date: Sun, 19 Jul 1998 13:34:12 -0400 (EDT)
From: tv@pobox.com
To: gnats-bugs@gnats.netbsd.org
Subject: pr inserts tabs with -i even for single spaces
X-Send-Pr-Version: 3.95

>Number:         5797
>Category:       bin
>Synopsis:       pr inserts tabs with -i even for single spaces
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 19 10:35:00 +0000 1998
>Closed-Date:    Thu Jul 13 02:09:25 +0000 2000
>Last-Modified:  Mon Mar 12 18:10:09 +0000 2012
>Originator:     Todd Vierling
>Release:        -current July 8
>Organization:
	duh.org - Pointing out the obvious since 1994.
>Environment:
System: NetBSD nc1.home.duh.org 1.3F NetBSD 1.3F (DUH) #0: Wed Jul 8 09:04:31 EDT 1998 tv@nc1.home.duh.org:/usr/SRC/netbsd/src/sys/arch/arm32/compile/DUH arm32

>Description:

The `pr' program, with the -i option, can "tabify" a file.  Unfortunately,
it does not do this in accordance with its manual pages which states
conversion of _multiple_ space characters into tabs; it will convert
single spaces that fall one character before a tab boundary into tabs as
well.

>How-To-Repeat:

% echo 'thisisa test' | pr -ti | hexdump -c
0000000   t   h   i   s   i   s   a  \t   t   e   s   t  \n

>Fix:

Dunno; too busy to find out just yet (put in a PR in case someone else is
bored).
>Release-Note:
>Audit-Trail:

From: Simon Burge <simonb@NetBSD.ORG>
To: tv@pobox.com
Cc: gnats-bugs@NetBSD.ORG, Simon Burge <simonb@NetBSD.ORG>
Subject: bin/5797
Date: Sun, 25 Jun 2000 15:09:02 +1000

 Todd,

 The following patch appears to do the right thing, are you happy with
 it?

 Simon.
 --
 Index: pr.c
 ===================================================================
 RCS file: /cvsroot/basesrc/usr.bin/pr/pr.c,v
 retrieving revision 1.7
 diff -p -u -r1.7 pr.c
 --- pr.c	1998/12/19 20:16:50	1.7
 +++ pr.c	2000/06/25 05:05:33
 @@ -1126,6 +1126,13 @@ otln(buf, cnt, svips, svops, mor)
  			 */
  			while (ops < ips) {
  				/*
 +				 * use one space if necessary
 +				 */
 +				if (ips - ops == 1) {
 +					putchar(' ');
 +					break;
 +				}
 +				/*
  				 * use as many ochar as will fit
  				 */
  				if ((tbps = ops + gap - (ops % gap)) > ips)
 @@ -1170,6 +1177,13 @@ otln(buf, cnt, svips, svops, mor)

  		if (mor < 0) {
  			while (ops < ips) {
 +				/*
 +				 * use one space if necessary
 +				 */
 +				if (ips - ops == 1) {
 +					putchar(' ');
 +					break;
 +				}
  				/*
  				 * use as many ochar as will fit
  				 */
State-Changed-From-To: open->closed 
State-Changed-By: simonb 
State-Changed-When: Wed Jul 12 19:08:39 PDT 2000 
State-Changed-Why:  
Patch applied, originator happy with the fix. 
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/5797 CVS commit: src/usr.bin/pr
Date: Mon, 12 Mar 2012 14:06:24 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Mar 12 18:06:24 UTC 2012

 Modified Files:
 	src/usr.bin/pr: pr.c

 Log Message:
 PR/41880: Ralph G. Previous fix for PR/5797 broke since space separator.


 To generate a diff of this commit:
 cvs rdiff -u -r1.21 -r1.22 src/usr.bin/pr/pr.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.