aboutsummaryrefslogtreecommitdiff
path: root/tools/plink/ldisc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-24 16:46:55 +0100
committermarha <marha@users.sourceforge.net>2012-01-24 16:46:55 +0100
commit6039fd0faf73c9d6c5b2abf9d824734218ec5eee (patch)
tree88f66f9d7c4763f206de6043ef45c63b94472690 /tools/plink/ldisc.c
parentb683b8f5675e280a6dd4ab82d6b9394182798b55 (diff)
downloadvcxsrv-6039fd0faf73c9d6c5b2abf9d824734218ec5eee.tar.gz
vcxsrv-6039fd0faf73c9d6c5b2abf9d824734218ec5eee.tar.bz2
vcxsrv-6039fd0faf73c9d6c5b2abf9d824734218ec5eee.zip
Update to putty 9388
Diffstat (limited to 'tools/plink/ldisc.c')
-rw-r--r--tools/plink/ldisc.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/tools/plink/ldisc.c b/tools/plink/ldisc.c
index 119a02acb..7ed42a37c 100644
--- a/tools/plink/ldisc.c
+++ b/tools/plink/ldisc.c
@@ -12,12 +12,12 @@
#include "terminal.h"
#include "ldisc.h"
-#define ECHOING (ldisc->cfg->localecho == FORCE_ON || \
- (ldisc->cfg->localecho == AUTO && \
+#define ECHOING (ldisc->localecho == FORCE_ON || \
+ (ldisc->localecho == AUTO && \
(ldisc->back->ldisc(ldisc->backhandle, LD_ECHO) || \
term_ldisc(ldisc->term, LD_ECHO))))
-#define EDITING (ldisc->cfg->localedit == FORCE_ON || \
- (ldisc->cfg->localedit == AUTO && \
+#define EDITING (ldisc->localedit == FORCE_ON || \
+ (ldisc->localedit == AUTO && \
(ldisc->back->ldisc(ldisc->backhandle, LD_EDIT) || \
term_ldisc(ldisc->term, LD_EDIT))))
@@ -76,7 +76,7 @@ static void bsb(Ldisc ldisc, int n)
#define CTRL(x) (x^'@')
#define KCTRL(x) ((x^'@') | 0x100)
-void *ldisc_create(Config *mycfg, Terminal *term,
+void *ldisc_create(Conf *conf, Terminal *term,
Backend *back, void *backhandle,
void *frontend)
{
@@ -87,12 +87,13 @@ void *ldisc_create(Config *mycfg, Terminal *term,
ldisc->bufsiz = 0;
ldisc->quotenext = 0;
- ldisc->cfg = mycfg;
ldisc->back = back;
ldisc->backhandle = backhandle;
ldisc->term = term;
ldisc->frontend = frontend;
+ ldisc_configure(ldisc, conf);
+
/* Link ourselves into the backend and the terminal */
if (term)
term->ldisc = ldisc;
@@ -102,6 +103,17 @@ void *ldisc_create(Config *mycfg, Terminal *term,
return ldisc;
}
+void ldisc_configure(void *handle, Conf *conf)
+{
+ Ldisc ldisc = (Ldisc) handle;
+
+ ldisc->telnet_keyboard = conf_get_int(conf, CONF_telnet_keyboard);
+ ldisc->telnet_newline = conf_get_int(conf, CONF_telnet_newline);
+ ldisc->protocol = conf_get_int(conf, CONF_protocol);
+ ldisc->localecho = conf_get_int(conf, CONF_localecho);
+ ldisc->localedit = conf_get_int(conf, CONF_localedit);
+}
+
void ldisc_free(void *handle)
{
Ldisc ldisc = (Ldisc) handle;
@@ -203,7 +215,7 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
* configured telnet specials off! This breaks
* talkers otherwise.
*/
- if (!ldisc->cfg->telnet_keyboard)
+ if (!ldisc->telnet_keyboard)
goto default_case;
if (c == CTRL('C'))
ldisc->back->special(ldisc->backhandle, TS_IP);
@@ -255,7 +267,7 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
* default clause because of the break.
*/
case CTRL('J'):
- if (ldisc->cfg->protocol == PROT_RAW &&
+ if (ldisc->protocol == PROT_RAW &&
ldisc->buflen > 0 && ldisc->buf[ldisc->buflen - 1] == '\r') {
if (ECHOING)
bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
@@ -264,9 +276,9 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
case KCTRL('M'): /* send with newline */
if (ldisc->buflen > 0)
ldisc->back->send(ldisc->backhandle, ldisc->buf, ldisc->buflen);
- if (ldisc->cfg->protocol == PROT_RAW)
+ if (ldisc->protocol == PROT_RAW)
ldisc->back->send(ldisc->backhandle, "\r\n", 2);
- else if (ldisc->cfg->protocol == PROT_TELNET && ldisc->cfg->telnet_newline)
+ else if (ldisc->protocol == PROT_TELNET && ldisc->telnet_newline)
ldisc->back->special(ldisc->backhandle, TS_EOL);
else
ldisc->back->send(ldisc->backhandle, "\r", 1);
@@ -300,27 +312,27 @@ void ldisc_send(void *handle, char *buf, int len, int interactive)
if (len > 0) {
if (ECHOING)
c_write(ldisc, buf, len);
- if (keyflag && ldisc->cfg->protocol == PROT_TELNET && len == 1) {
+ if (keyflag && ldisc->protocol == PROT_TELNET && len == 1) {
switch (buf[0]) {
case CTRL('M'):
- if (ldisc->cfg->protocol == PROT_TELNET && ldisc->cfg->telnet_newline)
+ if (ldisc->protocol == PROT_TELNET && ldisc->telnet_newline)
ldisc->back->special(ldisc->backhandle, TS_EOL);
else
ldisc->back->send(ldisc->backhandle, "\r", 1);
break;
case CTRL('?'):
case CTRL('H'):
- if (ldisc->cfg->telnet_keyboard) {
+ if (ldisc->telnet_keyboard) {
ldisc->back->special(ldisc->backhandle, TS_EC);
break;
}
case CTRL('C'):
- if (ldisc->cfg->telnet_keyboard) {
+ if (ldisc->telnet_keyboard) {
ldisc->back->special(ldisc->backhandle, TS_IP);
break;
}
case CTRL('Z'):
- if (ldisc->cfg->telnet_keyboard) {
+ if (ldisc->telnet_keyboard) {
ldisc->back->special(ldisc->backhandle, TS_SUSP);
break;
}