X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=telnet.c;h=8b2c4289ffd00f484d9e8f329315686d5bc14090;hb=6ef62aacfc5108355532ce82dc8eae7b7dc70e39;hp=5b3404888157793b9b841114cbd3c12aa6226136;hpb=f927fd972821cd3fa575872a220f7674ba0ad2b6;p=PuTTY.git diff --git a/telnet.c b/telnet.c index 5b340488..8b2c4289 100644 --- a/telnet.c +++ b/telnet.c @@ -244,6 +244,8 @@ typedef struct telnet_tag { } state; Config cfg; + + Pinger pinger; } *Telnet; #define TELNET_MAX_BACKLOG 4096 @@ -644,6 +646,7 @@ static int telnet_closing(Plug plug, const char *error_msg, int error_code, if (telnet->s) { sk_close(telnet->s); telnet->s = NULL; + notify_remote_exit(telnet->frontend); } if (error_msg) { /* A socket error has occurred. */ @@ -703,6 +706,8 @@ static const char *telnet_init(void *frontend_handle, void **backend_handle, telnet->term_width = telnet->cfg.width; telnet->term_height = telnet->cfg.height; telnet->state = TOP_LEVEL; + telnet->ldisc = NULL; + telnet->pinger = NULL; *backend_handle = telnet; /* @@ -738,6 +743,8 @@ static const char *telnet_init(void *frontend_handle, void **backend_handle, if ((err = sk_socket_error(telnet->s)) != NULL) return err; + telnet->pinger = pinger_new(&telnet->cfg, &telnet_backend, telnet); + /* * Initialise option states. */ @@ -762,6 +769,11 @@ static const char *telnet_init(void *frontend_handle, void **backend_handle, */ telnet->in_synch = FALSE; + /* + * We can send special commands from the start. + */ + update_specials_menu(telnet->frontend); + return NULL; } @@ -772,6 +784,8 @@ static void telnet_free(void *handle) sfree(telnet->sb_buf); if (telnet->s) sk_close(telnet->s); + if (telnet->pinger) + pinger_free(telnet->pinger); sfree(telnet); } /* @@ -782,6 +796,7 @@ static void telnet_free(void *handle) static void telnet_reconfig(void *handle, Config *cfg) { Telnet telnet = (Telnet) handle; + pinger_reconfig(telnet->pinger, &telnet->cfg, cfg); telnet->cfg = *cfg; /* STRUCTURE COPY */ } @@ -958,6 +973,8 @@ static void telnet_special(void *handle, Telnet_Special code) telnet->bufsize = sk_write(telnet->s, (char *)b, 2); } break; + default: + break; /* never heard of it */ } } @@ -971,15 +988,15 @@ static const struct telnet_special *telnet_get_specials(void *handle) {"Erase Line", TS_EL}, {"Go Ahead", TS_GA}, {"No Operation", TS_NOP}, - {"", 0}, + {NULL, TS_SEP}, {"Abort Process", TS_ABORT}, {"Abort Output", TS_AO}, {"Interrupt Process", TS_IP}, {"Suspend Process", TS_SUSP}, - {"", 0}, + {NULL, TS_SEP}, {"End Of Record", TS_EOR}, {"End Of File", TS_EOF}, - {NULL, 0} + {NULL, TS_EXITMENU} }; return specials; }