diff options
author | eadler <eadler@FreeBSD.org> | 2018-03-08 07:50:11 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2018-03-08 07:50:11 +0000 |
commit | a098d28fe069103ed41ad2d5b78d8736fc20335d (patch) | |
tree | f3201868aa9ddb97b12e5eb2e44f7c5165f01c34 /bin | |
parent | 1cf5146b107b042c2d239388114cad198673b3e4 (diff) | |
download | FreeBSD-src-a098d28fe069103ed41ad2d5b78d8736fc20335d.zip FreeBSD-src-a098d28fe069103ed41ad2d5b78d8736fc20335d.tar.gz |
MFC r323865:
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
Diffstat (limited to 'bin')
-rw-r--r-- | bin/cat/cat.c | 14 | ||||
-rw-r--r-- | bin/cat/tests/Makefile | 6 |
2 files changed, 10 insertions, 10 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 570e431..828b77f 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -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') { diff --git a/bin/cat/tests/Makefile b/bin/cat/tests/Makefile index 92e16ae..ebc313c 100644 --- a/bin/cat/tests/Makefile +++ b/bin/cat/tests/Makefile @@ -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> |