aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c311
1 files changed, 227 insertions, 84 deletions
diff --git a/server-client.c b/server-client.c
index fe72317a..92b3a6ad 100644
--- a/server-client.c
+++ b/server-client.c
@@ -41,7 +41,6 @@ static void server_client_check_redraw(struct client *);
static void server_client_set_title(struct client *);
static void server_client_reset_state(struct client *);
static int server_client_assume_paste(struct session *);
-static void server_client_clear_overlay(struct client *);
static void server_client_resize_event(int, short, void *);
static void server_client_dispatch(struct imsg *, void *);
@@ -79,8 +78,10 @@ server_client_overlay_timer(__unused int fd, __unused short events, void *data)
/* Set an overlay on client. */
void
-server_client_set_overlay(struct client *c, u_int delay, overlay_draw_cb drawcb,
- overlay_key_cb keycb, overlay_free_cb freecb, void *data)
+server_client_set_overlay(struct client *c, u_int delay,
+ overlay_check_cb checkcb, overlay_mode_cb modecb,
+ overlay_draw_cb drawcb, overlay_key_cb keycb, overlay_free_cb freecb,
+ void *data)
{
struct timeval tv;
@@ -96,17 +97,21 @@ server_client_set_overlay(struct client *c, u_int delay, overlay_draw_cb drawcb,
if (delay != 0)
evtimer_add(&c->overlay_timer, &tv);
+ c->overlay_check = checkcb;
+ c->overlay_mode = modecb;
c->overlay_draw = drawcb;
c->overlay_key = keycb;
c->overlay_free = freecb;
c->overlay_data = data;
- c->tty.flags |= (TTY_FREEZE|TTY_NOCURSOR);
+ c->tty.flags |= TTY_FREEZE;
+ if (c->overlay_mode == NULL)
+ c->tty.flags |= TTY_NOCURSOR;
server_redraw_client(c);
}
/* Clear overlay mode on client. */
-static void
+void
server_client_clear_overlay(struct client *c)
{
if (c->overlay_draw == NULL)
@@ -118,8 +123,12 @@ server_client_clear_overlay(struct client *c)
if (c->overlay_free != NULL)
c->overlay_free(c);
+ c->overlay_check = NULL;
+ c->overlay_mode = NULL;
c->overlay_draw = NULL;
c->overlay_key = NULL;
+ c->overlay_free = NULL;
+ c->overlay_data = NULL;
c->tty.flags &= ~(TTY_FREEZE|TTY_NOCURSOR);
server_redraw_client(c);
@@ -199,7 +208,7 @@ server_client_create(int fd)
c->fd = -1;
c->cwd = NULL;
- TAILQ_INIT(&c->queue);
+ c->queue = cmdq_new();
c->tty.fd = -1;
c->title = NULL;
@@ -285,7 +294,9 @@ server_client_lost(struct client *c)
if (c->flags & CLIENT_TERMINAL)
tty_free(&c->tty);
free(c->ttyname);
- free(c->term);
+
+ free(c->term_name);
+ free(c->term_type);
status_free(c);
@@ -344,8 +355,7 @@ server_client_free(__unused int fd, __unused short events, void *arg)
log_debug("free client %p (%d references)", c, c->references);
- if (!TAILQ_EMPTY(&c->queue))
- fatalx("queue not empty");
+ cmdq_free(c->queue);
if (c->references == 0) {
free((void *)c->name);
@@ -398,6 +408,8 @@ server_client_exec(struct client *c, const char *cmd)
shell = options_get_string(s->options, "default-shell");
else
shell = options_get_string(global_s_options, "default-shell");
+ if (!checkshell(shell))
+ shell = _PATH_BSHELL;
shellsize = strlen(shell) + 1;
msg = xmalloc(cmdsize + shellsize);
@@ -417,7 +429,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
struct winlink *wl;
struct window_pane *wp;
u_int x, y, b, sx, sy, px, py;
- int flag;
+ int ignore = 0;
key_code key;
struct timeval tv;
struct style_range *sr;
@@ -427,6 +439,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
UP,
DRAG,
WHEEL,
+ SECOND,
DOUBLE,
TRIPLE } type = NOTYPE;
enum { NOWHERE,
@@ -441,7 +454,12 @@ server_client_check_mouse(struct client *c, struct key_event *event)
m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag);
/* What type of event is this? */
- if ((m->sgr_type != ' ' &&
+ if (event->key == KEYC_DOUBLECLICK) {
+ type = DOUBLE;
+ x = m->x, y = m->y, b = m->b;
+ ignore = 1;
+ log_debug("double-click at %u,%u", x, y);
+ } else if ((m->sgr_type != ' ' &&
MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3) ||
(m->sgr_type == ' ' &&
@@ -475,11 +493,10 @@ server_client_check_mouse(struct client *c, struct key_event *event)
evtimer_del(&c->click_timer);
c->flags &= ~CLIENT_DOUBLECLICK;
if (m->b == c->click_button) {
- type = DOUBLE;
+ type = SECOND;
x = m->x, y = m->y, b = m->b;
- log_debug("double-click at %u,%u", x, y);
- flag = CLIENT_TRIPLECLICK;
- goto add_timer;
+ log_debug("second-click at %u,%u", x, y);
+ c->flags |= CLIENT_TRIPLECLICK;
}
} else if (c->flags & CLIENT_TRIPLECLICK) {
evtimer_del(&c->click_timer);
@@ -490,18 +507,18 @@ server_client_check_mouse(struct client *c, struct key_event *event)
log_debug("triple-click at %u,%u", x, y);
goto have_event;
}
+ } else {
+ type = DOWN;
+ x = m->x, y = m->y, b = m->b;
+ log_debug("down at %u,%u", x, y);
+ c->flags |= CLIENT_DOUBLECLICK;
}
- type = DOWN;
- x = m->x, y = m->y, b = m->b;
- log_debug("down at %u,%u", x, y);
- flag = CLIENT_DOUBLECLICK;
-
- add_timer:
if (KEYC_CLICK_TIMEOUT != 0) {
- c->flags |= flag;
+ memcpy(&c->click_event, m, sizeof c->click_event);
c->click_button = m->b;
+ log_debug("click timer started");
tv.tv_sec = KEYC_CLICK_TIMEOUT / 1000;
tv.tv_usec = (KEYC_CLICK_TIMEOUT % 1000) * 1000L;
evtimer_del(&c->click_timer);
@@ -516,6 +533,7 @@ have_event:
/* Save the session. */
m->s = s->id;
m->w = -1;
+ m->ignore = ignore;
/* Is this on the status line? */
m->statusat = status_at_line(c);
@@ -587,10 +605,9 @@ have_event:
wp = window_get_active_at(s->curw->window, px, py);
if (wp != NULL)
where = PANE;
+ else
+ return (KEYC_UNKNOWN);
}
-
- if (where == NOWHERE)
- return (KEYC_UNKNOWN);
if (where == PANE)
log_debug("mouse %u,%u on pane %%%u", x, y, wp->id);
else if (where == BORDER)
@@ -859,6 +876,52 @@ have_event:
break;
}
break;
+ case SECOND:
+ switch (MOUSE_BUTTONS(b)) {
+ case 0:
+ if (where == PANE)
+ key = KEYC_SECONDCLICK1_PANE;
+ if (where == STATUS)
+ key = KEYC_SECONDCLICK1_STATUS;
+ if (where == STATUS_LEFT)
+ key = KEYC_SECONDCLICK1_STATUS_LEFT;
+ if (where == STATUS_RIGHT)
+ key = KEYC_SECONDCLICK1_STATUS_RIGHT;
+ if (where == STATUS_DEFAULT)
+ key = KEYC_SECONDCLICK1_STATUS_DEFAULT;
+ if (where == BORDER)
+ key = KEYC_SECONDCLICK1_BORDER;
+ break;
+ case 1:
+ if (where == PANE)
+ key = KEYC_SECONDCLICK2_PANE;
+ if (where == STATUS)
+ key = KEYC_SECONDCLICK2_STATUS;
+ if (where == STATUS_LEFT)
+ key = KEYC_SECONDCLICK2_STATUS_LEFT;
+ if (where == STATUS_RIGHT)
+ key = KEYC_SECONDCLICK2_STATUS_RIGHT;
+ if (where == STATUS_DEFAULT)
+ key = KEYC_SECONDCLICK2_STATUS_DEFAULT;
+ if (where == BORDER)
+ key = KEYC_SECONDCLICK2_BORDER;
+ break;
+ case 2:
+ if (where == PANE)
+ key = KEYC_SECONDCLICK3_PANE;
+ if (where == STATUS)
+ key = KEYC_SECONDCLICK3_STATUS;
+ if (where == STATUS_LEFT)
+ key = KEYC_SECONDCLICK3_STATUS_LEFT;
+ if (where == STATUS_RIGHT)
+ key = KEYC_SECONDCLICK3_STATUS_RIGHT;
+ if (where == STATUS_DEFAULT)
+ key = KEYC_SECONDCLICK3_STATUS_DEFAULT;
+ if (where == BORDER)
+ key = KEYC_SECONDCLICK3_BORDER;
+ break;
+ }
+ break;
case DOUBLE:
switch (MOUSE_BUTTONS(b)) {
case 0:
@@ -1018,7 +1081,7 @@ server_client_update_latest(struct client *c)
static enum cmd_retval
server_client_key_callback(struct cmdq_item *item, void *data)
{
- struct client *c = item->client;
+ struct client *c = cmdq_get_client(item);
struct key_event *event = data;
key_code key = event->key;
struct mouse_event *m = &event->m;
@@ -1045,7 +1108,7 @@ server_client_key_callback(struct cmdq_item *item, void *data)
/* Check for mouse keys. */
m->valid = 0;
- if (key == KEYC_MOUSE) {
+ if (key == KEYC_MOUSE || key == KEYC_DOUBLECLICK) {
if (c->flags & CLIENT_READONLY)
goto out;
key = server_client_check_mouse(c, event);
@@ -1160,7 +1223,7 @@ try_again:
server_status_client(c);
/* Execute the key binding. */
- key_bindings_dispatch(bd, item, c, m, &fs);
+ key_bindings_dispatch(bd, item, c, event, &fs);
key_bindings_unref_table(table);
goto out;
}
@@ -1382,7 +1445,7 @@ server_client_resize_event(__unused int fd, __unused short events, void *data)
log_debug("%s: %%%u timer fired (was%s resized)", __func__, wp->id,
(wp->flags & PANE_RESIZED) ? "" : " not");
- if (wp->saved_grid == NULL && (wp->flags & PANE_RESIZED)) {
+ if (wp->base.saved_grid == NULL && (wp->flags & PANE_RESIZED)) {
log_debug("%s: %%%u deferring timer", __func__, wp->id);
server_client_start_resize_timer(wp);
} else if (!server_client_resize_force(wp)) {
@@ -1474,38 +1537,57 @@ focused:
static void
server_client_reset_state(struct client *c)
{
+ struct tty *tty = &c->tty;
struct window *w = c->session->curw->window;
struct window_pane *wp = w->active, *loop;
- struct screen *s = wp->screen;
+ struct screen *s;
struct options *oo = c->session->options;
- int mode, cursor = 0;
+ int mode, cursor, flags;
u_int cx = 0, cy = 0, ox, oy, sx, sy;
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return;
- if (c->overlay_draw != NULL)
- return;
- mode = s->mode;
- tty_region_off(&c->tty);
- tty_margin_off(&c->tty);
+ /* Disable the block flag. */
+ flags = (tty->flags & TTY_BLOCK);
+ tty->flags &= ~TTY_BLOCK;
- /* Move cursor to pane cursor and offset. */
- cursor = 0;
- tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
- if (wp->xoff + s->cx >= ox && wp->xoff + s->cx <= ox + sx &&
- wp->yoff + s->cy >= oy && wp->yoff + s->cy <= oy + sy) {
- cursor = 1;
+ /* Get mode from overlay if any, else from screen. */
+ if (c->overlay_draw != NULL) {
+ s = NULL;
+ if (c->overlay_mode == NULL)
+ mode = 0;
+ else
+ mode = c->overlay_mode(c, &cx, &cy);
+ } else {
+ s = wp->screen;
+ mode = s->mode;
+ }
+ log_debug("%s: client %s mode %x", __func__, c->name, mode);
- cx = wp->xoff + s->cx - ox;
- cy = wp->yoff + s->cy - oy;
+ /* Reset region and margin. */
+ tty_region_off(tty);
+ tty_margin_off(tty);
- if (status_at_line(c) == 0)
- cy += status_line_size(c);
+ /* Move cursor to pane cursor and offset. */
+ if (c->overlay_draw == NULL) {
+ cursor = 0;
+ tty_window_offset(tty, &ox, &oy, &sx, &sy);
+ if (wp->xoff + s->cx >= ox && wp->xoff + s->cx <= ox + sx &&
+ wp->yoff + s->cy >= oy && wp->yoff + s->cy <= oy + sy) {
+ cursor = 1;
+
+ cx = wp->xoff + s->cx - ox;
+ cy = wp->yoff + s->cy - oy;
+
+ if (status_at_line(c) == 0)
+ cy += status_line_size(c);
+ }
+ if (!cursor)
+ mode &= ~MODE_CURSOR;
}
- if (!cursor)
- mode &= ~MODE_CURSOR;
- tty_cursor(&c->tty, cx, cy);
+ log_debug("%s: cursor to %u,%u", __func__, cx, cy);
+ tty_cursor(tty, cx, cy);
/*
* Set mouse mode if requested. To support dragging, always use button
@@ -1513,21 +1595,27 @@ server_client_reset_state(struct client *c)
*/
if (options_get_number(oo, "mouse")) {
mode &= ~ALL_MOUSE_MODES;
- TAILQ_FOREACH(loop, &w->panes, entry) {
- if (loop->screen->mode & MODE_MOUSE_ALL)
- mode |= MODE_MOUSE_ALL;
+ if (c->overlay_draw == NULL) {
+ TAILQ_FOREACH(loop, &w->panes, entry) {
+ if (loop->screen->mode & MODE_MOUSE_ALL)
+ mode |= MODE_MOUSE_ALL;
+ }
}
if (~mode & MODE_MOUSE_ALL)
mode |= MODE_MOUSE_BUTTON;
}
/* Clear bracketed paste mode if at the prompt. */
- if (c->prompt_string != NULL)
+ if (c->overlay_draw == NULL && c->prompt_string != NULL)
mode &= ~MODE_BRACKETPASTE;
/* Set the terminal mode and reset attributes. */
- tty_update_mode(&c->tty, mode, s);
- tty_reset(&c->tty);
+ tty_update_mode(tty, mode, s);
+ tty_reset(tty);
+
+ /* All writing must be done, send a sync end (if it was started). */
+ tty_sync_end(tty);
+ tty->flags |= flags;
}
/* Repeat time callback. */
@@ -1547,8 +1635,22 @@ server_client_repeat_timer(__unused int fd, __unused short events, void *data)
static void
server_client_click_timer(__unused int fd, __unused short events, void *data)
{
- struct client *c = data;
+ struct client *c = data;
+ struct key_event *event;
+ log_debug("click timer expired");
+
+ if (c->flags & CLIENT_TRIPLECLICK) {
+ /*
+ * Waiting for a third click that hasn't happened, so this must
+ * have been a double click.
+ */
+ event = xmalloc(sizeof *event);
+ event->key = KEYC_DOUBLECLICK;
+ memcpy(&event->m, &c->click_event, sizeof event->m);
+ if (!server_client_handle_key(c, event))
+ free(event);
+ }
c->flags &= ~(CLIENT_DOUBLECLICK|CLIENT_TRIPLECLICK);
}
@@ -1588,8 +1690,11 @@ server_client_check_redraw(struct client *c)
{
struct session *s = c->session;
struct tty *tty = &c->tty;
+ struct window *w = c->session->curw->window;
struct window_pane *wp;
- int needed, flags;
+ int needed, flags, mode = tty->mode, new_flags = 0;
+ int redraw;
+ u_int bit = 0;
struct timeval tv = { .tv_usec = 1000 };
static struct event ev;
size_t left;
@@ -1597,11 +1702,12 @@ server_client_check_redraw(struct client *c)
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return;
if (c->flags & CLIENT_ALLREDRAWFLAGS) {
- log_debug("%s: redraw%s%s%s%s", c->name,
+ log_debug("%s: redraw%s%s%s%s%s", c->name,
(c->flags & CLIENT_REDRAWWINDOW) ? " window" : "",
(c->flags & CLIENT_REDRAWSTATUS) ? " status" : "",
(c->flags & CLIENT_REDRAWBORDERS) ? " borders" : "",
- (c->flags & CLIENT_REDRAWOVERLAY) ? " overlay" : "");
+ (c->flags & CLIENT_REDRAWOVERLAY) ? " overlay" : "",
+ (c->flags & CLIENT_REDRAWPANES) ? " panes" : "");
}
/*
@@ -1613,12 +1719,14 @@ server_client_check_redraw(struct client *c)
if (c->flags & CLIENT_ALLREDRAWFLAGS)
needed = 1;
else {
- TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {
+ TAILQ_FOREACH(wp, &w->panes, entry) {
if (wp->flags & PANE_REDRAW) {
needed = 1;
break;
}
}
+ if (needed)
+ new_flags |= CLIENT_REDRAWPANES;
}
if (needed && (left = EVBUFFER_LENGTH(tty->out)) != 0) {
log_debug("%s: redraw deferred (%zu left)", c->name, left);
@@ -1629,29 +1737,53 @@ server_client_check_redraw(struct client *c)
evtimer_add(&ev, &tv);
}
- /*
- * We may have got here for a single pane redraw, but force a
- * full redraw next time in case other panes have been updated.
- */
- c->flags |= CLIENT_ALLREDRAWFLAGS;
+ if (~c->flags & CLIENT_REDRAWWINDOW) {
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ if (wp->flags & PANE_REDRAW) {
+ log_debug("%s: pane %%%u needs redraw",
+ c->name, wp->id);
+ c->redraw_panes |= (1 << bit);
+ }
+ if (++bit == 64) {
+ /*
+ * If more that 64 panes, give up and
+ * just redraw the window.
+ */
+ new_flags &= CLIENT_REDRAWPANES;
+ new_flags |= CLIENT_REDRAWWINDOW;
+ break;
+ }
+ }
+ if (c->redraw_panes != 0)
+ c->flags |= CLIENT_REDRAWPANES;
+ }
+ c->flags |= new_flags;
return;
} else if (needed)
log_debug("%s: redraw needed", c->name);
flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR);
- tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE)) | TTY_NOCURSOR;
+ tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE))|TTY_NOCURSOR;
if (~c->flags & CLIENT_REDRAWWINDOW) {
/*
* If not redrawing the entire window, check whether each pane
* needs to be redrawn.
*/
- TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {
- if (wp->flags & PANE_REDRAW) {
- tty_update_mode(tty, tty->mode, NULL);
- screen_redraw_pane(c, wp);
- }
+ TAILQ_FOREACH(wp, &w->panes, entry) {
+ redraw = 0;
+ if (wp->flags & PANE_REDRAW)
+ redraw = 1;
+ else if (c->flags & CLIENT_REDRAWPANES)
+ redraw = !!(c->redraw_panes & (1 << bit));
+ bit++;
+ if (!redraw)
+ continue;
+ log_debug("%s: redrawing pane %%%u", __func__, wp->id);
+ screen_redraw_pane(c, wp);
}
+ c->redraw_panes = 0;
+ c->flags &= ~CLIENT_REDRAWPANES;
}
if (c->flags & CLIENT_ALLREDRAWFLAGS) {
@@ -1660,8 +1792,9 @@ server_client_check_redraw(struct client *c)
screen_redraw_screen(c);
}
- tty->flags = (tty->flags & ~(TTY_FREEZE|TTY_NOCURSOR)) | flags;
- tty_update_mode(tty, tty->mode, NULL);
+ tty->flags = (tty->flags & ~TTY_NOCURSOR)|(flags & TTY_NOCURSOR);
+ tty_update_mode(tty, mode, NULL);
+ tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR))|flags;
c->flags &= ~(CLIENT_ALLREDRAWFLAGS|CLIENT_STATUSFORCE);
@@ -1720,6 +1853,7 @@ server_client_dispatch(struct imsg *imsg, void *arg)
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
switch (imsg->hdr.type) {
+ case MSG_IDENTIFY_FEATURES:
case MSG_IDENTIFY_FLAGS:
case MSG_IDENTIFY_TERM:
case MSG_IDENTIFY_TTYNAME:
@@ -1800,10 +1934,12 @@ server_client_dispatch(struct imsg *imsg, void *arg)
static enum cmd_retval
server_client_command_done(struct cmdq_item *item, __unused void *data)
{
- struct client *c = item->client;
+ struct client *c = cmdq_get_client(item);
if (~c->flags & CLIENT_ATTACHED)
c->flags |= CLIENT_EXIT;
+ else if (~c->flags & CLIENT_DETACHING)
+ tty_send_requests(&c->tty);
return (CMD_RETURN_NORMAL);
}
@@ -1855,7 +1991,7 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
}
cmd_free_argv(argc, argv);
- cmdq_append(c, cmdq_get_command(pr->cmdlist, NULL, NULL, 0));
+ cmdq_append(c, cmdq_get_command(pr->cmdlist, NULL));
cmdq_append(c, cmdq_get_callback(server_client_command_done, NULL));
cmd_list_free(pr->cmdlist);
@@ -1876,7 +2012,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
{
const char *data, *home;
size_t datalen;
- int flags;
+ int flags, feat;
char *name;
if (c->flags & CLIENT_IDENTIFIED)
@@ -1886,6 +2022,14 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
datalen = imsg->hdr.len - IMSG_HEADER_SIZE;
switch (imsg->hdr.type) {
+ case MSG_IDENTIFY_FEATURES:
+ if (datalen != sizeof feat)
+ fatalx("bad MSG_IDENTIFY_FEATURES size");
+ memcpy(&feat, data, sizeof feat);
+ c->term_features |= feat;
+ log_debug("client %p IDENTIFY_FEATURES %s", c,
+ tty_get_features(feat));
+ break;
case MSG_IDENTIFY_FLAGS:
if (datalen != sizeof flags)
fatalx("bad MSG_IDENTIFY_FLAGS size");
@@ -1896,7 +2040,10 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
case MSG_IDENTIFY_TERM:
if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_TERM string");
- c->term = xstrdup(data);
+ if (*data == '\0')
+ c->term_name = xstrdup("unknown");
+ else
+ c->term_name = xstrdup(data);
log_debug("client %p IDENTIFY_TERM %s", c, data);
break;
case MSG_IDENTIFY_TTYNAME:
@@ -1926,7 +2073,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
if (datalen == 0 || data[datalen - 1] != '\0')
fatalx("bad MSG_IDENTIFY_ENVIRON string");
if (strchr(data, '=') != NULL)
- environ_put(c->environ, data);
+ environ_put(c->environ, data, 0);
log_debug("client %p IDENTIFY_ENVIRON %s", c, data);
break;
case MSG_IDENTIFY_CLIENTPID:
@@ -1961,14 +2108,10 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
control_start(c);
c->tty.fd = -1;
} else if (c->fd != -1) {
- if (tty_init(&c->tty, c, c->fd, c->term) != 0) {
+ if (tty_init(&c->tty, c, c->fd) != 0) {
close(c->fd);
c->fd = -1;
} else {
- if (c->flags & CLIENT_UTF8)
- c->tty.flags |= TTY_UTF8;
- if (c->flags & CLIENT_256COLOURS)
- c->tty.term_flags |= TERM_256COLOURS;
tty_resize(&c->tty);
c->flags |= CLIENT_TERMINAL;
}
@@ -1992,7 +2135,7 @@ server_client_dispatch_shell(struct client *c)
const char *shell;
shell = options_get_string(global_s_options, "default-shell");
- if (*shell == '\0' || areshell(shell))
+ if (!checkshell(shell))
shell = _PATH_BSHELL;
proc_send(c->peer, MSG_SHELL, -1, shell, strlen(shell) + 1);