svn commit: r323865 - in head/bin/cat: . tests

Sevan Janiyan sevan at FreeBSD.org
Thu Sep 21 14:14:50 UTC 2017


Author: sevan (doc committer)
Date: Thu Sep 21 14:14:49 2017
New Revision: 323865
URL: https://svnweb.freebsd.org/changeset/base/323865

Log:
  Ammend bin/cat/cat.c so the output is the same aside
  from blank lines being numbered or unnumbered, depending on whether cat
  was invoked with -ne or -be.
  
  At present, when cat is invoked with -be, there is an aditional
  difference that the '$' on blank lines is placed on the far left of the
  output.
  
  Discussed in bug 210607.
  
  While here, revert the workaround from r304035 which skipped the unit test for
  this issue previously.
  
  PR:		210607
  Submitted by:	myself
  Reviewed by:	bdrewery
  Obtained from:	NetBSD
  Relnotes:	yes
  Differential Revision:	https://reviews.freebsd.org/D12432

Modified:
  head/bin/cat/cat.c
  head/bin/cat/tests/Makefile

Modified: head/bin/cat/cat.c
==============================================================================
--- head/bin/cat/cat.c	Thu Sep 21 14:14:01 2017	(r323864)
+++ head/bin/cat/cat.c	Thu Sep 21 14:14:49 2017	(r323865)
@@ -226,10 +226,16 @@ cook_cat(FILE *fp)
 				} else
 					gobble = 0;
 			}
-			if (nflag && (!bflag || ch != '\n')) {
-				(void)fprintf(stdout, "%6d\t", ++line);
-				if (ferror(stdout))
-					break;
+			if (nflag) {
+				if (!bflag || ch != '\n') {
+					(void)fprintf(stdout, "%6d\t", ++line);
+					if (ferror(stdout))
+						break;
+				} else if (eflag) {
+					(void)fprintf(stdout, "%6s\t", "");
+					if (ferror(stdout))
+						break;
+				}
 			}
 		}
 		if (ch == '\n') {

Modified: head/bin/cat/tests/Makefile
==============================================================================
--- head/bin/cat/tests/Makefile	Thu Sep 21 14:14:01 2017	(r323864)
+++ head/bin/cat/tests/Makefile	Thu Sep 21 14:14:49 2017	(r323865)
@@ -17,10 +17,4 @@ ${PACKAGE}FILES+=		d_vt_output.out
 
 .include <netbsd-tests.test.mk>
 
-d_align.out: ${TESTSRC}/d_align.out
-	sed -E -e 's,^[[:space:]]{7}\$$$$,\$$,' < ${.ALLSRC} > ${.TARGET}.tmp
-	mv ${.TARGET}.tmp ${.TARGET}
-
-CLEANFILES+=			d_align.out d_align.out.tmp
-
 .include <bsd.test.mk>


More information about the svn-src-all mailing list