diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-08-20 12:10:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-09-28 15:41:33 +0200 |
commit | e652e5f8db08ac4240cc3f5779b3439e02bff40f (patch) | |
tree | c0d0b6fcb3440236c7a8289ac12d24389d8c01cd | |
parent | mpc55xxevb: Fix compilation in start-config-siu-pcr.c (diff) | |
download | rtems-e652e5f8db08ac4240cc3f5779b3439e02bff40f.tar.bz2 |
telnetd: Inform client that we will echo
The standard line editor rtems_shell_line_editor() produces an echo.
-rw-r--r-- | cpukit/telnetd/pty.c | 27 |
1 files 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); }; |