X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/e8fa8f62da443bfc89c416d3eeafcde69c8c6403..125105d16c788398562ac03e91ce7a0dc0292492:/raw.c diff --git a/raw.c b/raw.c index 94ff43f1..10e9ce64 100644 --- a/raw.c +++ b/raw.c @@ -80,7 +80,7 @@ static char *raw_init(void *frontend_handle, void **backend_handle, char *err; Raw raw; - raw = smalloc(sizeof(*raw)); + raw = snew(struct raw_backend_data); raw->fn = &fn_table; raw->s = NULL; *backend_handle = raw; @@ -123,6 +123,15 @@ static char *raw_init(void *frontend_handle, void **backend_handle, return NULL; } +static void raw_free(void *handle) +{ + Raw raw = (Raw) handle; + + if (raw->s) + sk_close(raw->s); + sfree(raw); +} + /* * Stub routine (we don't have any need to reconfigure this backend). */ @@ -172,6 +181,15 @@ static void raw_special(void *handle, Telnet_Special code) return; } +/* + * Return a list of the special codes that make sense in this + * protocol. + */ +static const struct telnet_special *raw_get_specials(void *handle) +{ + return NULL; +} + static Socket raw_socket(void *handle) { Raw raw = (Raw) handle; @@ -208,17 +226,23 @@ static void raw_provide_logctx(void *handle, void *logctx) static int raw_exitcode(void *handle) { - /* Exit codes are a meaningless concept in the Raw protocol */ - return 0; + Raw raw = (Raw) handle; + if (raw->s != NULL) + return -1; /* still connected */ + else + /* Exit codes are a meaningless concept in the Raw protocol */ + return 0; } Backend raw_backend = { raw_init, + raw_free, raw_reconfig, raw_send, raw_sendbuffer, raw_size, raw_special, + raw_get_specials, raw_socket, raw_exitcode, raw_sendok,