1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 11:02:48 -05:00

The back ends now contain their own copies of the Config structure,

and have a function to pass in a new one. (Well, actually several
back ends don't actually bother to do this because they need nothing
out of Config after the initial setup phase, but they could if they
wanted to.)

[originally from svn r2561]
This commit is contained in:
Simon Tatham
2003-01-12 14:48:29 +00:00
parent cf2bcad348
commit f49c8c5a07
12 changed files with 190 additions and 114 deletions

View File

@ -2411,7 +2411,8 @@ int main(int argc, char **argv)
term_provide_logctx(inst->term, inst->logctx);
inst->back = &pty_backend;
inst->back->init((void *)inst->term, &inst->backhandle, NULL, 0, NULL, 0);
inst->back->init((void *)inst->term, &inst->backhandle, &cfg,
NULL, 0, NULL, 0);
inst->back->provide_logctx(inst->backhandle, inst->logctx);
term_provide_resize_fn(inst->term, inst->back->size, inst->backhandle);

View File

@ -389,7 +389,7 @@ void pty_pre_init(void)
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static char *pty_init(void *frontend, void **backend_handle,
static char *pty_init(void *frontend, void **backend_handle, Config *cfg,
char *host, int port, char **realhost, int nodelay)
{
int slavefd;
@ -398,8 +398,8 @@ static char *pty_init(void *frontend, void **backend_handle,
pty_frontend = frontend;
*backend_handle = NULL; /* we can't sensibly use this, sadly */
pty_term_width = cfg.width;
pty_term_height = cfg.height;
pty_term_width = cfg->width;
pty_term_height = cfg->height;
if (pty_master_fd < 0)
pty_open_master();
@ -411,7 +411,7 @@ static char *pty_init(void *frontend, void **backend_handle,
{
struct termios attrs;
tcgetattr(pty_master_fd, &attrs);
attrs.c_cc[VERASE] = cfg.bksp_is_delete ? '\177' : '\010';
attrs.c_cc[VERASE] = cfg->bksp_is_delete ? '\177' : '\010';
tcsetattr(pty_master_fd, TCSANOW, &attrs);
}
@ -419,7 +419,7 @@ static char *pty_init(void *frontend, void **backend_handle,
* Stamp utmp (that is, tell the utmp helper process to do so),
* or not.
*/
if (!cfg.stamp_utmp)
if (!cfg->stamp_utmp)
close(pty_utmp_helper_pipe); /* just let the child process die */
else {
char *location = get_x_display(pty_frontend);
@ -472,8 +472,8 @@ static char *pty_init(void *frontend, void **backend_handle,
for (i = 3; i < 1024; i++)
close(i);
{
char term_env_var[10 + sizeof(cfg.termtype)];
sprintf(term_env_var, "TERM=%s", cfg.termtype);
char term_env_var[10 + sizeof(cfg->termtype)];
sprintf(term_env_var, "TERM=%s", cfg->termtype);
putenv(term_env_var);
}
/*
@ -488,7 +488,7 @@ static char *pty_init(void *frontend, void **backend_handle,
else {
char *shell = getenv("SHELL");
char *shellname;
if (cfg.login_shell) {
if (cfg->login_shell) {
char *p = strrchr(shell, '/');
shellname = smalloc(2+strlen(shell));
p = p ? p+1 : shell;
@ -511,6 +511,13 @@ static char *pty_init(void *frontend, void **backend_handle,
return NULL;
}
/*
* Stub routine (we don't have any need to reconfigure this backend).
*/
static void pty_reconfig(void *handle, Config *cfg)
{
}
/*
* Called to send data down the pty.
*/
@ -617,6 +624,7 @@ static int pty_exitcode(void *handle)
Backend pty_backend = {
pty_init,
pty_reconfig,
pty_send,
pty_sendbuffer,
pty_size,

View File

@ -551,7 +551,7 @@ int main(int argc, char **argv)
/* nodelay is only useful if stdin is a terminal device */
int nodelay = cfg.tcp_nodelay && isatty(0);
error = back->init(NULL, &backhandle, cfg.host, cfg.port,
error = back->init(NULL, &backhandle, &cfg, cfg.host, cfg.port,
&realhost, nodelay);
if (error) {
fprintf(stderr, "Unable to open connection:\n%s\n", error);