1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Rethink the whole line discipline architecture. Instead of having

multiple switchable line disciplines, we now have a single unified
one which changes its behaviour based on option settings. Each
option setting can be suggested by the back end and/or the terminal
handler, and can be forcibly overridden by the configuration. Local
echo and local line editing are separate, independently switchable,
options.

[originally from svn r895]
This commit is contained in:
Simon Tatham
2001-01-24 14:08:20 +00:00
parent 89505459e3
commit 7a79df8fe6
12 changed files with 329 additions and 217 deletions

View File

@ -132,6 +132,8 @@ static struct Opt *opts[] = {
&o_we_sga, &o_they_sga, NULL
};
static int echoing = TRUE, editing = TRUE;
static int in_synch;
static int sb_opt, sb_len;
static char *sb_buf = NULL;
@ -170,8 +172,11 @@ static void deactivate_option (struct Opt *o) {
* 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;
if (o->option == TELOPT_ECHO && o->send == DO)
echoing = !enabled;
else if (o->option = TELOPT_SGA && o->send == DO)
editing = !enabled;
ldisc_send(NULL, 0); /* cause ldisc to notice the change */
}
static void activate_option (struct Opt *o) {
@ -509,15 +514,6 @@ static char *telnet_init (char *host, int port, char **realhost) {
/*
* Initialise option states.
*/
if( cfg.ldisc_term )
{
struct Opt **o;
for (o = opts; *o; o++)
if ((*o)->state == REQUESTED)
(*o)->state = INACTIVE;
}
else
{
struct Opt **o;
@ -531,11 +527,6 @@ static char *telnet_init (char *host, int port, char **realhost) {
*/
in_synch = FALSE;
/*
* We have no pre-session phase.
*/
begin_session();
return NULL;
}
@ -638,6 +629,12 @@ static Socket telnet_socket(void) { return s; }
static int telnet_sendok(void) { return 1; }
static int telnet_ldisc(int option) {
if (option == LD_ECHO) return echoing;
if (option == LD_EDIT) return editing;
return FALSE;
}
Backend telnet_backend = {
telnet_init,
telnet_send,
@ -645,5 +642,6 @@ Backend telnet_backend = {
telnet_special,
telnet_socket,
telnet_sendok,
telnet_ldisc,
23
};