Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/tip Make cu(1) and tip(1) recognize newline (^J) as ...



details:   https://anonhg.NetBSD.org/src/rev/c28a5f9e0562
branches:  trunk
changeset: 996695:c28a5f9e0562
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Feb 06 14:08:50 2019 +0000

description:
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:

 usr.bin/tip/tip.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 3ff2f4d1f1f6 -r c28a5f9e0562 usr.bin/tip/tip.c
--- a/usr.bin/tip/tip.c Wed Feb 06 13:28:08 2019 +0000
+++ b/usr.bin/tip/tip.c Wed Feb 06 14:08:50 2019 +0000
@@ -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 @@
 #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 @@
                    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;



Home | Main Index | Thread Index | Old Index