Subject: Re: bin/32759: Output of cat -s -n is wrong
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, uhel@gmx.net>
From: David Holland <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 10/08/2006 21:40:04
The following reply was made to PR bin/32759; it has been noted by GNATS.

From: dholland@eecs.harvard.edu (David Holland)
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/32759: Output of cat -s -n is wrong
Date: Sun, 8 Oct 2006 17:35:19 -0400 (EDT)

 The patch above fails if you do just cat -s. Try this one:
 
 Index: cat.c
 ===================================================================
 RCS file: /cvsroot/src/bin/cat/cat.c,v
 retrieving revision 1.44
 diff -u -r1.44 cat.c
 --- cat.c	26 Feb 2006 19:44:24 -0000	1.44
 +++ cat.c	8 Oct 2006 21:33:24 -0000
 @@ -175,7 +175,10 @@
  		if (prev == '\n') {
  			if (ch == '\n') {
  				if (sflag) {
 -					if (!gobble && putchar(ch) == EOF)
 +					if (!gobble && nflag && !bflag)
 +						(void)fprintf(stdout,
 +							"%6d\t\n", ++line);
 +					else if (!gobble && putchar(ch) == EOF)
  						break;
  					gobble = 1;
  					continue;
 
 
 -- 
    - David A. Holland / dholland@eecs.harvard.edu