From e652e5f8db08ac4240cc3f5779b3439e02bff40f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 20 Aug 2012 12:10:03 +0200 Subject: telnetd: Inform client that we will echo The standard line editor rtems_shell_line_editor() produces an echo. --- cpukit/telnetd/pty.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/cpukit/telnetd/pty.c b/cpukit/telnetd/pty.c index e73f0e515a..9d3e48f043 100644 --- a/cpukit/telnetd/pty.c +++ b/cpukit/telnetd/pty.c @@ -88,6 +88,16 @@ static pty_t *telnet_ptys; static rtems_device_major_number pty_major; +static +int send_iac(int minor,unsigned char mode,unsigned char option) +{ + unsigned char buf[3]; + + buf[0]=IAC_ESC; + buf[1]=mode; + buf[2]=option; + return write(telnet_ptys[minor].socket,buf,sizeof(buf)); +} /* This procedure returns the devname for a pty slot free. * If not slot availiable (field socket>=0) @@ -118,6 +128,10 @@ char * telnet_get_pty(int socket) t.tv_usec=00000; setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(t)); telnet_ptys[ndx].socket=socket; + + /* inform the client that we will echo */ + send_iac(ndx, IAC_WILL, 1); + return telnet_ptys[ndx].devname; }; }; @@ -138,17 +152,6 @@ static const char IAC_AYT_RSP[]="\r\nAYT? Yes, RTEMS-SHELL is here\r\n"; static const char IAC_BRK_RSP[]="<*Break*>"; static const char IAC_IP_RSP []="<*Interrupt*>"; -static -int send_iac(int minor,unsigned char mode,unsigned char option) -{ - unsigned char buf[3]; - - buf[0]=IAC_ESC; - buf[1]=mode; - buf[2]=option; - return write(telnet_ptys[minor].socket,buf,sizeof(buf)); -} - static int handleSB(pty_t *pty) { @@ -284,7 +287,7 @@ static int read_pty(int minor) if (value==3) { send_iac(minor,IAC_WILL, 3); /* GO AHEAD*/ } else if (value==1) { - /* ECHO */ + send_iac(minor,IAC_WILL, 1); /* ECHO */ } else { send_iac(minor,IAC_WONT,value); }; -- cgit v1.2.3