aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <schwarze>2016-07-01 22:40:44 +0000
committerschwarze <schwarze>2016-07-01 22:40:44 +0000
commit8d150fd96395487bdc70f7a585822226145f5315 (patch)
treea8696ad0c2cfab3d5c7c039fc1917ba99a2ecfa6
parent46ef23f299464049c8b95c31b0e40221b248dc9b (diff)
downloadcat-8d150fd96395487bdc70f7a585822226145f5315.tar
cat-8d150fd96395487bdc70f7a585822226145f5315.tar.gz
For -be, indent the $ on blank lines.
Patch from Giles Lean (NetBSD PR bin/4841), tweaked by kleink at NetBSD (rev. 1.17 1998-01-27), version for OpenBSD sent in by Sevan Janiyan <venture37 at geeklan dot co dot uk>. OK deraadt@
-rw-r--r--cat.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/cat.c b/cat.c
index 8d6f0b6..9cbca97 100644
--- a/cat.c
+++ b/cat.c
@@ -153,10 +153,16 @@ cook_buf(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') {