[BusyBox-cvs] svn commit: trunk/busybox/networking

pgf at busybox.net pgf at busybox.net
Wed Jul 20 19:55:20 UTC 2005


Author: pgf
Date: 2005-07-20 13:55:19 -0600 (Wed, 20 Jul 2005)
New Revision: 10886

Log:
applying fix for:
    0000026: poor man's "scriptable" telnet



Modified:
   trunk/busybox/networking/telnet.c


Changeset:
Modified: trunk/busybox/networking/telnet.c
===================================================================
--- trunk/busybox/networking/telnet.c	2005-07-20 19:49:15 UTC (rev 10885)
+++ trunk/busybox/networking/telnet.c	2005-07-20 19:55:19 UTC (rev 10886)
@@ -96,6 +96,7 @@
 	byte    charmode;
 	byte    telflags;
 	byte	gotsig;
+	byte	do_termios;
 	/* buffer to handle telnet negotiations */
 	char    iacbuf[IACBUFSIZE];
 	short	iaclen; /* could even use byte */
@@ -616,12 +617,12 @@
 
 static void rawmode(void)
 {
-	tcsetattr(0, TCSADRAIN, &G.termios_raw);
+	if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_raw);
 }
 
 static void cookmode(void)
 {
-	tcsetattr(0, TCSADRAIN, &G.termios_def);
+	if (G.do_termios) tcsetattr(0, TCSADRAIN, &G.termios_def);
 }
 
 extern int telnet_main(int argc, char** argv)
@@ -649,11 +650,12 @@
 
 	memset(&G, 0, sizeof G);
 
-	if (tcgetattr(0, &G.termios_def) < 0)
-		exit(1);
+	if (tcgetattr(0, &G.termios_def) >= 0) {
+		G.do_termios = 1;
 
-	G.termios_raw = G.termios_def;
-	cfmakeraw(&G.termios_raw);
+		G.termios_raw = G.termios_def;
+		cfmakeraw(&G.termios_raw);
+	}
 
 	if (argc < 2)
 		bb_show_usage();




More information about the busybox-cvs mailing list