diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-16 12:35:05 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-09-16 12:35:05 +0000 |
commit | a52b2186877eb82197db226ad6589a8743b6c299 (patch) | |
tree | 354d58b6c46b7b3d048161ae5c84f5a128525fd0 /usr.bin/tmux/window.c | |
parent | 040854e58efbc3bb4fcf77070c0857e4ba32bd5a (diff) |
Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r-- | usr.bin/tmux/window.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 71dd36521f1..ecc4646d321 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.24 2009/09/01 14:40:33 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.25 2009/09/16 12:35:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -454,6 +454,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, struct environ_entry *envent; const char *ptr; struct timeval tv; + struct termios tio2; u_int i; if (wp->fd != -1) @@ -484,7 +485,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, tv.tv_usec = NAME_INTERVAL * 1000L; timeradd(&wp->window->name_timer, &tv, &wp->window->name_timer); - switch (wp->pid = forkpty(&wp->fd, wp->tty, tio, &ws)) { + switch (wp->pid = forkpty(&wp->fd, wp->tty, NULL, &ws)) { case -1: wp->fd = -1; xasprintf(cause, "%s: %s", cmd, strerror(errno)); @@ -493,6 +494,14 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, if (chdir(wp->cwd) != 0) chdir("/"); + if (tcgetattr(STDIN_FILENO, &tio2) != 0) + fatal("tcgetattr failed"); + if (tio != NULL) + memcpy(tio2.c_cc, tio->c_cc, sizeof tio2.c_cc); + tio2.c_cc[VERASE] = '\177'; + if (tcsetattr(STDIN_FILENO, TCSANOW, &tio2) != 0) + fatal("tcgetattr failed"); + ARRAY_INIT(&varlist); for (varp = environ; *varp != NULL; varp++) { var = xstrdup(*varp); |