1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-02-09 16:36:34 +00:00

Robert de Bath's patch: integrate line disciplines into Telnet and have them

interoperate sensibly with ECHO negotiations

[originally from svn r401]
This commit is contained in:
Simon Tatham 2000-03-11 14:06:11 +00:00
parent 4b3c825ec7
commit 3ee28098bc
3 changed files with 26 additions and 3 deletions

View File

@ -79,7 +79,7 @@ GLOBAL char *logfile;
typedef enum { typedef enum {
TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT, TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF, TS_LECHO, TS_RECHO
} Telnet_Special; } Telnet_Special;
typedef enum { typedef enum {

View File

@ -216,6 +216,11 @@ static void activate_option (struct Opt *o) {
*/ */
deactivate_option (o->option==TELOPT_NEW_ENVIRON ? &o_oenv : &o_nenv); deactivate_option (o->option==TELOPT_NEW_ENVIRON ? &o_oenv : &o_nenv);
} }
if (o->option == TELOPT_ECHO)
{
cfg.ldisc_term = FALSE;
ldisc = &ldisc_simple;
}
} }
static void refused_option (struct Opt *o) { static void refused_option (struct Opt *o) {
@ -224,6 +229,11 @@ static void refused_option (struct Opt *o) {
send_opt (WILL, TELOPT_OLD_ENVIRON); send_opt (WILL, TELOPT_OLD_ENVIRON);
o_oenv.state = REQUESTED; o_oenv.state = REQUESTED;
} }
if (o->option == TELOPT_ECHO)
{
cfg.ldisc_term = TRUE;
ldisc = &ldisc_term;
}
} }
static void proc_rec_opt (int cmd, int option) { static void proc_rec_opt (int cmd, int option) {
@ -719,8 +729,20 @@ static void telnet_special (Telnet_Special code) {
case TS_EOF: b[1] = xEOF; s_write (b, 2); break; case TS_EOF: b[1] = xEOF; s_write (b, 2); break;
case TS_SYNCH: case TS_SYNCH:
outbuf_head = outbuf_reap = 0; outbuf_head = outbuf_reap = 0;
b[0] = DM; b[1] = DM;
send (s, b, 1, MSG_OOB); send (s, b, 2, MSG_OOB);
break;
case TS_RECHO:
if (o_echo.state == INACTIVE || o_echo.state == REALLY_INACTIVE) {
o_echo.state = REQUESTED;
send_opt (o_echo.send, o_echo.option);
}
break;
case TS_LECHO:
if (o_echo.state == ACTIVE) {
o_echo.state = REQUESTED;
send_opt (o_echo.nsend, o_echo.option);
}
break; break;
} }
} }

View File

@ -730,6 +730,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
init_fonts(); init_fonts();
sfree(logpal); sfree(logpal);
ldisc = (cfg.ldisc_term ? &ldisc_term : &ldisc_simple); ldisc = (cfg.ldisc_term ? &ldisc_term : &ldisc_simple);
back->special (cfg.ldisc_term ? TS_LECHO : TS_RECHO);
if (pal) if (pal)
DeleteObject(pal); DeleteObject(pal);
logpal = NULL; logpal = NULL;