Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/bin/cat Pull up following revision(s) (requested by sevan...
details: https://anonhg.NetBSD.org/src/rev/22c5a5d5982b
branches: netbsd-6
changeset: 777156:22c5a5d5982b
user: snj <snj%NetBSD.org@localhost>
date: Sat Mar 25 17:41:48 2017 +0000
description:
Pull up following revision(s) (requested by sevan in ticket #1387):
bin/cat/cat.c: revision 1.57
When invoked with -se, print a '$' on blank lines
Obtained from OpenBSD r1.13 of src/bin/cat/cat.c
Closes PR bin/51250
Reviewed by Christos@
diffstat:
bin/cat/cat.c | 26 +++++++++-----------------
1 files changed, 9 insertions(+), 17 deletions(-)
diffs (58 lines):
diff -r 8e56685608a8 -r 22c5a5d5982b bin/cat/cat.c
--- a/bin/cat/cat.c Sat Mar 25 17:35:56 2017 +0000
+++ b/bin/cat/cat.c Sat Mar 25 17:41:48 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cat.c,v 1.47 2008/07/20 00:52:39 lukem Exp $ */
+/* $NetBSD: cat.c,v 1.47.20.1 2017/03/25 17:41:48 snj Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -44,7 +44,7 @@
#if 0
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
#else
-__RCSID("$NetBSD: cat.c,v 1.47 2008/07/20 00:52:39 lukem Exp $");
+__RCSID("$NetBSD: cat.c,v 1.47.20.1 2017/03/25 17:41:48 snj Exp $");
#endif
#endif /* not lint */
@@ -172,18 +172,16 @@
line = gobble = 0;
for (prev = '\n'; (ch = getc(fp)) != EOF; prev = ch) {
if (prev == '\n') {
- if (ch == '\n') {
- if (sflag) {
- if (!gobble && nflag && !bflag)
- (void)fprintf(stdout,
- "%6d\t\n", ++line);
- else if (!gobble && putchar(ch) == EOF)
- break;
+ if (sflag) {
+ if (ch == '\n') {
+ if (gobble)
+ continue;
gobble = 1;
- continue;
+ } else
+ gobble = 0;
}
if (nflag) {
- if (!bflag) {
+ if (!bflag || ch != '\n') {
(void)fprintf(stdout,
"%6d\t", ++line);
if (ferror(stdout))
@@ -195,13 +193,7 @@
break;
}
}
- } else if (nflag) {
- (void)fprintf(stdout, "%6d\t", ++line);
- if (ferror(stdout))
- break;
}
- }
- gobble = 0;
if (ch == '\n') {
if (eflag)
if (putchar('$') == EOF)
Home |
Main Index |
Thread Index |
Old Index