projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Turned the old `Telnet Command' System-submenu into a more general
[u/mdw/putty]
/
raw.c
diff --git
a/raw.c
b/raw.c
index
0990333
..
10e9ce6
100644
(file)
--- a/
raw.c
+++ b/
raw.c
@@
-80,7
+80,7
@@
static char *raw_init(void *frontend_handle, void **backend_handle,
char *err;
Raw raw;
char *err;
Raw raw;
- raw = s
malloc(sizeof(*raw)
);
+ raw = s
new(struct raw_backend_data
);
raw->fn = &fn_table;
raw->s = NULL;
*backend_handle = raw;
raw->fn = &fn_table;
raw->s = NULL;
*backend_handle = raw;
@@
-96,7
+96,7
@@
static char *raw_init(void *frontend_handle, void **backend_handle,
logevent(raw->frontend, buf);
sfree(buf);
}
logevent(raw->frontend, buf);
sfree(buf);
}
- addr = name_lookup(host, port, realhost);
+ addr = name_lookup(host, port, realhost
, cfg
);
if ((err = sk_addr_error(addr)) != NULL)
return err;
if ((err = sk_addr_error(addr)) != NULL)
return err;
@@
-113,7
+113,8
@@
static char *raw_init(void *frontend_handle, void **backend_handle,
logevent(raw->frontend, buf);
sfree(buf);
}
logevent(raw->frontend, buf);
sfree(buf);
}
- raw->s = new_connection(addr, *realhost, port, 0, 1, nodelay, (Plug) raw);
+ raw->s = new_connection(addr, *realhost, port, 0, 1, nodelay,
+ (Plug) raw, cfg);
if ((err = sk_socket_error(raw->s)) != NULL)
return err;
if ((err = sk_socket_error(raw->s)) != NULL)
return err;
@@
-122,6
+123,15
@@
static char *raw_init(void *frontend_handle, void **backend_handle,
return NULL;
}
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).
*/
/*
* Stub routine (we don't have any need to reconfigure this backend).
*/
@@
-171,6
+181,15
@@
static void raw_special(void *handle, Telnet_Special code)
return;
}
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;
static Socket raw_socket(void *handle)
{
Raw raw = (Raw) handle;
@@
-207,17
+226,23
@@
static void raw_provide_logctx(void *handle, void *logctx)
static int raw_exitcode(void *handle)
{
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,
}
Backend raw_backend = {
raw_init,
+ raw_free,
raw_reconfig,
raw_send,
raw_sendbuffer,
raw_size,
raw_special,
raw_reconfig,
raw_send,
raw_sendbuffer,
raw_size,
raw_special,
+ raw_get_specials,
raw_socket,
raw_exitcode,
raw_sendok,
raw_socket,
raw_exitcode,
raw_sendok,