summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d870b56)
I'm not actually sure why we've always had back ends notify ldisc of
changes to echo/edit settings by giving ldisc_send(ldisc,NULL,0,0) a
special meaning, instead of by having a separate dedicated notify
function with its own prototype and parameter set. Coverity's recent
observation that the two kinds of call don't even have the same
requirements on the ldisc (particularly, whether ldisc->term can be
NULL) makes me realise that it's really high time I separated the two
conceptually different operations into actually different functions.
While I'm here, I've renamed the confusing ldisc_update() function
which that special operation ends up feeding to, because it's not
actually a function applying to an ldisc - it applies to a front end.
So ldisc_send(ldisc,NULL,0,0) is now ldisc_echoedit_update(ldisc), and
that in turn figures out the current echo/edit settings before passing
them on to frontend_echoedit_update(). I think that should be clearer.
12 files changed:
+void ldisc_echoedit_update(void *handle)
+{
+ Ldisc ldisc = (Ldisc) handle;
+ frontend_echoedit_update(ldisc->frontend, ECHOING, EDITING);
+}
+
void ldisc_send(void *handle, char *buf, int len, int interactive)
{
Ldisc ldisc = (Ldisc) handle;
int keyflag = 0;
void ldisc_send(void *handle, char *buf, int len, int interactive)
{
Ldisc ldisc = (Ldisc) handle;
int keyflag = 0;
- /*
- * Called with len=0 when the options change. We must inform
- * the front end in case it needs to know.
- */
- if (len == 0) {
- ldisc_update(ldisc->frontend, ECHOING, EDITING);
- return;
- }
- /*
- * If that wasn't true, then we expect ldisc->term to be non-NULL
- * hereafter. (The only front ends which have an ldisc but no term
- * are those which do networking but no terminal emulation, in
- * which case they need the above if statement to handle
- * ldisc_updates passed from the back ends, but should never send
- * any actual input through this function.)
- */
/*
* Notify the front end that something was pressed, in case
/*
* Notify the front end that something was pressed, in case
[win notifyRemoteExit];
}
[win notifyRemoteExit];
}
-void ldisc_update(void *frontend, int echo, int edit)
+void frontend_echoedit_update(void *frontend, int echo, int edit)
{
//SessionWindow *win = (SessionWindow *)frontend;
/*
{
//SessionWindow *win = (SessionWindow *)frontend;
/*
*/
#define MAX_SCP_BUFSIZE 16384
*/
#define MAX_SCP_BUFSIZE 16384
-void ldisc_send(void *handle, char *buf, int len, int interactive)
-{
- /*
- * This is only here because of the calls to ldisc_send(NULL,
- * 0) in ssh.c. Nothing in PSCP actually needs to use the ldisc
- * as an ldisc. So if we get called with any real data, I want
- * to know about it.
- */
- assert(len == 0);
-}
+void ldisc_echoedit_update(void *handle) { }
static void tell_char(FILE * stream, char c)
{
static void tell_char(FILE * stream, char c)
{
-void ldisc_send(void *handle, char *buf, int len, int interactive)
-{
- /*
- * This is only here because of the calls to ldisc_send(NULL,
- * 0) in ssh.c. Nothing in PSFTP actually needs to use the
- * ldisc as an ldisc. So if we get called with any real data, I
- * want to know about it.
- */
- assert(len == 0);
-}
+void ldisc_echoedit_update(void *handle) { }
/*
* In psftp, all agent requests should be synchronous, so this is a
/*
* In psftp, all agent requests should be synchronous, so this is a
void sys_cursor(void *frontend, int x, int y);
void request_paste(void *frontend);
void frontend_keypress(void *frontend);
void sys_cursor(void *frontend, int x, int y);
void request_paste(void *frontend);
void frontend_keypress(void *frontend);
-void ldisc_update(void *frontend, int echo, int edit);
+void frontend_echoedit_update(void *frontend, int echo, int edit);
/* It's the backend's responsibility to invoke this at the start of a
* connection, if necessary; it can also invoke it later if the set of
* special commands changes. It does not need to invoke it at session
/* It's the backend's responsibility to invoke this at the start of a
* connection, if necessary; it can also invoke it later if the set of
* special commands changes. It does not need to invoke it at session
void ldisc_configure(void *, Conf *);
void ldisc_free(void *);
void ldisc_send(void *handle, char *buf, int len, int interactive);
void ldisc_configure(void *, Conf *);
void ldisc_free(void *);
void ldisc_send(void *handle, char *buf, int len, int interactive);
+void ldisc_echoedit_update(void *handle);
/*
* Exports from ldiscucs.c.
/*
* Exports from ldiscucs.c.
ssh_special(ssh, TS_EOF);
if (ssh->ldisc)
ssh_special(ssh, TS_EOF);
if (ssh->ldisc)
- ldisc_send(ssh->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
+ ldisc_echoedit_update(ssh->ldisc); /* cause ldisc to notice changes */
ssh->send_ok = 1;
ssh->channels = newtree234(ssh_channelcmp);
while (1) {
ssh->send_ok = 1;
ssh->channels = newtree234(ssh_channelcmp);
while (1) {
* Transfer data!
*/
if (ssh->ldisc)
* Transfer data!
*/
if (ssh->ldisc)
- ldisc_send(ssh->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
+ ldisc_echoedit_update(ssh->ldisc); /* cause ldisc to notice changes */
if (ssh->mainchan)
ssh->send_ok = 1;
while (1) {
if (ssh->mainchan)
ssh->send_ok = 1;
while (1) {
else if (o->option == TELOPT_SGA && o->send == DO)
telnet->editing = !enabled;
if (telnet->ldisc) /* cause ldisc to notice the change */
else if (o->option == TELOPT_SGA && o->send == DO)
telnet->editing = !enabled;
if (telnet->ldisc) /* cause ldisc to notice the change */
- ldisc_send(telnet->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(telnet->ldisc);
/* Ensure we get the minimum options */
if (!telnet->activated) {
/* Ensure we get the minimum options */
if (!telnet->activated) {
{
power_on(term, clear);
if (term->ldisc) /* cause ldisc to notice changes */
{
power_on(term, clear);
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
term->disptop = 0;
deselect(term);
term_update(term);
term->disptop = 0;
deselect(term);
term_update(term);
case 10: /* DECEDM: set local edit mode */
term->term_editing = state;
if (term->ldisc) /* cause ldisc to notice changes */
case 10: /* DECEDM: set local edit mode */
term->term_editing = state;
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
break;
case 25: /* DECTCEM: enable/disable cursor */
compatibility2(OTHER, VT220);
break;
case 25: /* DECTCEM: enable/disable cursor */
compatibility2(OTHER, VT220);
case 12: /* SRM: set echo mode */
term->term_echoing = !state;
if (term->ldisc) /* cause ldisc to notice changes */
case 12: /* SRM: set echo mode */
term->term_echoing = !state;
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
break;
case 20: /* LNM: Return sends ... */
term->cr_lf_return = state;
break;
case 20: /* LNM: Return sends ... */
term->cr_lf_return = state;
compatibility(VT100);
power_on(term, TRUE);
if (term->ldisc) /* cause ldisc to notice changes */
compatibility(VT100);
power_on(term, TRUE);
if (term->ldisc) /* cause ldisc to notice changes */
- ldisc_send(term->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(term->ldisc);
if (term->reset_132) {
if (!term->no_remote_resize)
request_resize(term->frontend, 80, term->rows);
if (term->reset_132) {
if (!term->no_remote_resize)
request_resize(term->frontend, 80, term->rows);
}
/* Dummy routine, only required in plink. */
}
/* Dummy routine, only required in plink. */
-void ldisc_update(void *frontend, int echo, int edit)
+void frontend_echoedit_update(void *frontend, int echo, int edit)
struct gui_data *inst = (struct gui_data *)data;
term_pwron(inst->term, TRUE);
if (inst->ldisc)
struct gui_data *inst = (struct gui_data *)data;
term_pwron(inst->term, TRUE);
if (inst->ldisc)
- ldisc_send(inst->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(inst->ldisc);
}
void copy_all_menuitem(GtkMenuItem *item, gpointer data)
}
void copy_all_menuitem(GtkMenuItem *item, gpointer data)
*/
if (inst->ldisc) {
ldisc_configure(inst->ldisc, inst->conf);
*/
if (inst->ldisc) {
ldisc_configure(inst->ldisc, inst->conf);
- ldisc_send(inst->ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(inst->ldisc);
}
/* Pass new config data to the terminal */
term_reconfig(inst->term, inst->conf);
}
/* Pass new config data to the terminal */
term_reconfig(inst->term, inst->conf);
- ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */
+ ldisc_echoedit_update(inst->ldisc); /* cause ldisc to notice changes */
/* now we're reday to deal with the child exit handler being
* called */
/* now we're reday to deal with the child exit handler being
* called */
-void ldisc_update(void *frontend, int echo, int edit)
+void frontend_echoedit_update(void *frontend, int echo, int edit)
{
/* Update stdin read mode to reflect changes in line discipline. */
struct termios mode;
{
/* Update stdin read mode to reflect changes in line discipline. */
struct termios mode;
mode.c_cc[VMIN] = 1;
mode.c_cc[VTIME] = 0;
/* FIXME: perhaps what we do with IXON/IXOFF should be an
mode.c_cc[VMIN] = 1;
mode.c_cc[VTIME] = 0;
/* FIXME: perhaps what we do with IXON/IXOFF should be an
- * argument to ldisc_update(), to allow implementation of SSH-2
- * "xon-xoff" and Rlogin's equivalent? */
+ * argument to frontend_echoedit_update(), to allow
+ * implementation of SSH-2 "xon-xoff" and Rlogin's
+ * equivalent? */
mode.c_iflag &= ~IXON;
mode.c_iflag &= ~IXOFF;
}
mode.c_iflag &= ~IXON;
mode.c_iflag &= ~IXOFF;
}
*/
local_tty = (tcgetattr(STDIN_FILENO, &orig_termios) == 0);
atexit(cleanup_termios);
*/
local_tty = (tcgetattr(STDIN_FILENO, &orig_termios) == 0);
atexit(cleanup_termios);
- ldisc_update(NULL, 1, 1);
+ frontend_echoedit_update(NULL, 1, 1);
sending = FALSE;
now = GETTICKCOUNT();
sending = FALSE;
now = GETTICKCOUNT();
const int share_can_be_upstream = TRUE;
/* Dummy routine, only required in plink. */
const int share_can_be_upstream = TRUE;
/* Dummy routine, only required in plink. */
-void ldisc_update(void *frontend, int echo, int edit)
+void frontend_echoedit_update(void *frontend, int echo, int edit)
*/
if (ldisc) {
ldisc_configure(ldisc, conf);
*/
if (ldisc) {
ldisc_configure(ldisc, conf);
- ldisc_send(ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(ldisc);
}
if (pal)
DeleteObject(pal);
}
if (pal)
DeleteObject(pal);
case IDM_RESET:
term_pwron(term, TRUE);
if (ldisc)
case IDM_RESET:
term_pwron(term, TRUE);
if (ldisc)
- ldisc_send(ldisc, NULL, 0, 0);
+ ldisc_echoedit_update(ldisc);
break;
case IDM_ABOUT:
showabout(hwnd);
break;
case IDM_ABOUT:
showabout(hwnd);
-void ldisc_update(void *frontend, int echo, int edit)
+void frontend_echoedit_update(void *frontend, int echo, int edit)
{
/* Update stdin read mode to reflect changes in line discipline. */
DWORD mode;
{
/* Update stdin read mode to reflect changes in line discipline. */
DWORD mode;