[BusyBox-cvs] busybox/networking telnetd.c,1.8,1.9

Erik Andersen andersen at busybox.net
Fri Dec 19 11:30:16 UTC 2003


Update of /var/cvs/busybox/networking
In directory nail:/tmp/cvs-serv21591/networking

Modified Files:
	telnetd.c 
Log Message:
Patch from Fillod Stephane:

* While I'm at it, there's also a "telnetd.patch" which maps CRLF to CR,
  like netkit-telnet does, required by the loosy Windows telnet clients.



Index: telnetd.c
===================================================================
RCS file: /var/cvs/busybox/networking/telnetd.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- telnetd.c	12 Sep 2003 11:27:15 -0000	1.8
+++ telnetd.c	19 Dec 2003 11:30:13 -0000	1.9
@@ -116,6 +116,8 @@
    FIXME - if we mean to send 0xFF to the terminal then it will be escaped,
    what is the escape character?  We aren't handling that situation here.
 
+   CR-LF ->'s CR mapping is also done here, for convenience
+
   */
 static char *
 remove_iacs(struct tsession *ts, int *pnum_totty) {
@@ -128,7 +130,14 @@
 
 	while (ptr < end) {
 		if (*ptr != IAC) {
+			int c = *ptr;
 			*totty++ = *ptr++;
+			/* We now map \r\n ==> \r for pragmatic reasons.
+			 * Many client implementations send \r\n when
+			 * the user hits the CarriageReturn key.
+			 */
+			if (c == '\r' && (*ptr == '\n' || *ptr == 0) && ptr < end)
+				ptr++;
 		}
 		else {
 			if ((ptr+2) < end) {




More information about the busybox-cvs mailing list