Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2018-09-24 11:35:52 +0300
committerSimon Tatham <anakin@pobox.com>2018-09-24 11:43:39 +0300
commitf4fbaa1bd987dea038282e514d99162789f0a697 (patch)
treecfab1efe33439752be316a9b27a88e919a1eb545 /ldisc.c
parent26f7a2ac723629bc0f56728eff3eb99f4dd742e6 (diff)
Rework special-commands system to add an integer argument.
In order to list cross-certifiable host keys in the GUI specials menu, the SSH backend has been inventing new values on the end of the Telnet_Special enumeration, starting from the value TS_LOCALSTART. This is inelegant, and also makes it awkward to break up special handlers (e.g. to dispatch different specials to different SSH layers), since if all you know about a special is that it's somewhere in the TS_LOCALSTART+n space, you can't tell what _general kind_ of thing it is. Also, if I ever need another open-ended set of specials in future, I'll have to remember which TS_LOCALSTART+n codes are in which set. So here's a revamp that causes every special to take an extra integer argument. For all previously numbered specials, this argument is passed as zero and ignored, but there's a new main special code for SSH host key cross-certification, in which the integer argument is an index into the backend's list of available keys. TS_LOCALSTART is now a thing of the past: if I need any other open-ended sets of specials in future, I can add a new top-level code with a nicely separated space of arguments. While I'm at it, I've removed the legacy misnomer 'Telnet_Special' from the code completely; the enum is now SessionSpecialCode, the struct containing full details of a menu entry is SessionSpecial, and the enum values now start SS_ rather than TS_.
Diffstat (limited to 'ldisc.c')
-rw-r--r--ldisc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/ldisc.c b/ldisc.c
index e17b13c7..f411174a 100644
--- a/ldisc.c
+++ b/ldisc.c
@@ -217,7 +217,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
bsb(ldisc, plen(ldisc, ldisc->buf[ldisc->buflen - 1]));
ldisc->buflen--;
}
- backend_special(ldisc->backend, TS_EL);
+ backend_special(ldisc->backend, SS_EL, 0);
/*
* We don't send IP, SUSP or ABORT if the user has
* configured telnet specials off! This breaks
@@ -226,11 +226,11 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
if (!ldisc->telnet_keyboard)
goto default_case;
if (c == CTRL('C'))
- backend_special(ldisc->backend, TS_IP);
+ backend_special(ldisc->backend, SS_IP, 0);
if (c == CTRL('Z'))
- backend_special(ldisc->backend, TS_SUSP);
+ backend_special(ldisc->backend, SS_SUSP, 0);
if (c == CTRL('\\'))
- backend_special(ldisc->backend, TS_ABORT);
+ backend_special(ldisc->backend, SS_ABORT, 0);
break;
case CTRL('R'): /* redraw line */
if (ECHOING) {
@@ -245,7 +245,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
break;
case CTRL('D'): /* logout or send */
if (ldisc->buflen == 0) {
- backend_special(ldisc->backend, TS_EOF);
+ backend_special(ldisc->backend, SS_EOF, 0);
} else {
backend_send(ldisc->backend, ldisc->buf, ldisc->buflen);
ldisc->buflen = 0;
@@ -288,7 +288,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
if (ldisc->protocol == PROT_RAW)
backend_send(ldisc->backend, "\r\n", 2);
else if (ldisc->protocol == PROT_TELNET && ldisc->telnet_newline)
- backend_special(ldisc->backend, TS_EOL);
+ backend_special(ldisc->backend, SS_EOL, 0);
else
backend_send(ldisc->backend, "\r", 1);
if (ECHOING)
@@ -325,24 +325,24 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, int interactive)
switch (buf[0]) {
case CTRL('M'):
if (ldisc->protocol == PROT_TELNET && ldisc->telnet_newline)
- backend_special(ldisc->backend, TS_EOL);
+ backend_special(ldisc->backend, SS_EOL, 0);
else
backend_send(ldisc->backend, "\r", 1);
break;
case CTRL('?'):
case CTRL('H'):
if (ldisc->telnet_keyboard) {
- backend_special(ldisc->backend, TS_EC);
+ backend_special(ldisc->backend, SS_EC, 0);
break;
}
case CTRL('C'):
if (ldisc->telnet_keyboard) {
- backend_special(ldisc->backend, TS_IP);
+ backend_special(ldisc->backend, SS_IP, 0);
break;
}
case CTRL('Z'):
if (ldisc->telnet_keyboard) {
- backend_special(ldisc->backend, TS_SUSP);
+ backend_special(ldisc->backend, SS_SUSP, 0);
break;
}