Module Name:    src
Committed By:   rin
Date:           Wed Feb  6 14:08:50 UTC 2019

Modified Files:
        src/usr.bin/tip: tip.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.bin/tip/tip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/tip/tip.c
diff -u src/usr.bin/tip/tip.c:1.59 src/usr.bin/tip/tip.c:1.60
--- src/usr.bin/tip/tip.c:1.59	Mon Sep  5 00:40:30 2016
+++ src/usr.bin/tip/tip.c	Wed Feb  6 14:08:50 2019
@@ -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, 19
 #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;

Reply via email to