From: simon Date: Tue, 24 Oct 2000 11:16:25 +0000 (+0000) Subject: Fix failure to re-enable local line discipline when TELOPT_ECHO is X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/708bbbbe30a499a0a51e0356e7056206b15989fd Fix failure to re-enable local line discipline when TELOPT_ECHO is turned _back off_ by the remote server. (server sends WONT) git-svn-id: svn://svn.tartarus.org/sgt/putty@756 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/telnet.c b/telnet.c index ff6681f6..8eb6e8a7 100644 --- a/telnet.c +++ b/telnet.c @@ -166,6 +166,14 @@ static void deactivate_option (struct Opt *o) { o->state = REALLY_INACTIVE; } +/* + * Generate side effects of enabling or disabling an option. + */ +static void option_side_effects(struct Opt *o, int enabled) { + if (o->option == TELOPT_ECHO && cfg.ldisc_term) + ldisc = enabled ? &ldisc_simple : &ldisc_term; +} + static void activate_option (struct Opt *o) { if (o->send == WILL && o->option == TELOPT_NAWS) telnet_size(); @@ -178,8 +186,7 @@ static void activate_option (struct Opt *o) { */ deactivate_option (o->option==TELOPT_NEW_ENVIRON ? &o_oenv : &o_nenv); } - if (o->option == TELOPT_ECHO && cfg.ldisc_term) - ldisc = &ldisc_simple; + option_side_effects(o, 1); } static void refused_option (struct Opt *o) { @@ -188,8 +195,7 @@ static void refused_option (struct Opt *o) { send_opt (WILL, TELOPT_OLD_ENVIRON); o_oenv.state = REQUESTED; } - if (o->option == TELOPT_ECHO && cfg.ldisc_term) - ldisc = &ldisc_term; + option_side_effects(o, 0); } static void proc_rec_opt (int cmd, int option) { @@ -224,6 +230,7 @@ static void proc_rec_opt (int cmd, int option) { case ACTIVE: (*o)->state = INACTIVE; send_opt ((*o)->nsend, option); + option_side_effects(*o, 0); break; case INACTIVE: case REALLY_INACTIVE: