tech-userlevel archive

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

cu(1) / tip(1) : recognize newline as end-of-line



Hi,

Currently, cu(1) and tip(1) do not recognize a newline as end-of-line.
This means that an escape character (~) does not work after ^J (dislike ^M).

It seems like a bug for me. But, are there some reasons for this behavior?

I would like to commit the patch below, if there's no objections.

Thanks,
rin
----
Index: usr.bin/tip/tip.c
===================================================================
RCS file: /home/netbsd/src/usr.bin/tip/tip.c,v
retrieving revision 1.59
diff -p -u -r1.59 tip.c
--- usr.bin/tip/tip.c	5 Sep 2016 00:40:30 -0000	1.59
+++ usr.bin/tip/tip.c	27 Jan 2019 10:08:03 -0000
@@ -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;


Home | Main Index | Thread Index | Old Index