Sync OpenBSD patchset 1111:

Add a helper function to open the terminal for attach-/new-session.
This commit is contained in:
Tiago Cunha
2012-05-12 15:00:19 +00:00
parent 2f0db58777
commit 1340c012b0
4 changed files with 25 additions and 19 deletions

View File

@ -104,6 +104,25 @@ server_client_create(int fd)
log_debug("new client %d", fd);
}
/* Open client terminal if needed. */
int
server_client_open(struct client *c, struct session *s, char **cause)
{
struct options *oo = s != NULL ? &s->options : &global_s_options;
char *overrides;
if (!(c->flags & CLIENT_TERMINAL)) {
*cause = xstrdup ("not a terminal");
return (-1);
}
overrides = options_get_string(oo, "terminal-overrides");
if (tty_open(&c->tty, overrides, cause) != 0)
return (-1);
return (0);
}
/* Lost a client. */
void
server_client_lost(struct client *c)