summaryrefslogtreecommitdiff
path: root/usr.bin/tip
diff options
context:
space:
mode:
authorrin <rin@NetBSD.org>2019-02-06 14:08:50 +0000
committerrin <rin@NetBSD.org>2019-02-06 14:08:50 +0000
commit08ff1e9a2eeca87b60cc9357c49d5edee1b51273 (patch)
treea86dca6066776bc0897ab2fbf7d9c0476e121489 /usr.bin/tip
parentce859ae85761ef3c1676810abba36bbc145fa7bb (diff)
Make cu(1) and tip(1) recognize newline (^J) as end-of-line.
Now, tilde (~) after newline works as escape character as in ssh(1). No objections when proposed on tech-userland.
Diffstat (limited to 'usr.bin/tip')
-rw-r--r--usr.bin/tip/tip.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c
index aa8ce1ee165..b08758a14f0 100644
--- a/usr.bin/tip/tip.c
+++ b/usr.bin/tip/tip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tip.c,v 1.59 2016/09/05 00:40:30 sevan Exp $ */
+/* $NetBSD: tip.c,v 1.60 2019/02/06 14:08:50 rin Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\
#if 0
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: tip.c,v 1.59 2016/09/05 00:40:30 sevan Exp $");
+__RCSID("$NetBSD: tip.c,v 1.60 2019/02/06 14:08:50 rin Exp $");
#endif /* not lint */
/*
@@ -358,11 +358,11 @@ tipin(void)
gch && gch == character(value(RAISECHAR))) {
setboolean(value(RAISE), !boolean(value(RAISE)));
continue;
- } else if (gch == '\r') {
+ } else if (gch == '\r' || gch == '\n') {
bol = 1;
xpwrite(FD, &gch, 1);
if (boolean(value(HALFDUPLEX)))
- (void)printf("\r\n");
+ (void)printf("%s\n", gch == '\r' ? "\r" : "");
continue;
} else if (!cumode && gch && gch == character(value(FORCE)))
gch = getchar()&STRIP_PAR;