Reset ignored signals after forkpty.

pull/1/head
Nicholas Marriott 2007-09-20 09:43:33 +00:00
parent 9c0b51cd5d
commit 2cd99f0ebb
6 changed files with 44 additions and 13 deletions

View File

@ -1,5 +1,6 @@
20 September 2007
* Reset ignored signals in child after forkpty, makes ^C work.
* Wrap on next/previous. From Maximilian Gass.
19 September 2007
@ -24,5 +25,5 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.6 2007-09-20 08:21:59 nicm Exp $
$Id: CHANGES,v 1.7 2007-09-20 09:43:33 nicm Exp $

1
TODO
View File

@ -8,7 +8,6 @@
- sort out who controls the buffers in local.c a bit
- better checking/emulation for missing term requirements
- alt charset, borders etc (terminfo(5)/Line Graphics)
- wrap windows with forward/back
- new window command prompt
- mouse handling and some other bits elinks needs
- scrollback

15
local.c
View File

@ -1,4 +1,4 @@
/* $Id: local.c,v 1.5 2007-08-28 09:19:50 nicm Exp $ */
/* $Id: local.c,v 1.6 2007-09-20 09:43:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -22,6 +22,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#define TTYDEFCHARS
#include <termios.h>
#include <term.h>
#include <unistd.h>
@ -229,10 +230,14 @@ local_init(struct buffer **in, struct buffer **out)
if (tcgetattr(local_fd, &local_tio) != 0)
fatal("tcgetattr failed");
memcpy(&tio, &local_tio, sizeof tio);
tio.c_iflag &= ~(IXON|IXOFF|ICRNL|INLCR);
tio.c_oflag &= ~(OPOST|ONLCR|OCRNL|ONLRET);
tio.c_lflag &= ~(IEXTEN|ICANON|ECHO|ECHOE|ECHOKE|ECHOCTL|ISIG);
memset(&tio, 0, sizeof tio);
tio.c_iflag = TTYDEF_IFLAG & ~(IXON|IXOFF|ICRNL|INLCR);
tio.c_oflag = TTYDEF_OFLAG & ~(OPOST|ONLCR|OCRNL|ONLRET);
tio.c_lflag =
TTYDEF_LFLAG & ~(IEXTEN|ICANON|ECHO|ECHOE|ECHOKE|ECHOCTL|ISIG);
tio.c_cflag = TTYDEF_CFLAG;
memcpy(&tio.c_cc, ttydefchars, sizeof tio.c_cc);
cfsetspeed(&tio, TTYDEF_SPEED);
if (tcsetattr(local_fd, TCSANOW, &tio) != 0)
fatal("tcsetattr failed");

3
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.6 2007-08-28 09:36:33 nicm Exp $ */
/* $Id: tmux.c,v 1.7 2007-09-20 09:43:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -155,6 +155,7 @@ main(int argc, char **argv)
xfree(path);
/* Set up signal handlers. */
memset(&act, 0, sizeof act);
sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;

8
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.7 2007-08-28 09:19:50 nicm Exp $ */
/* $Id: tmux.h,v 1.8 2007-09-20 09:43:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -16,8 +16,8 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef NSCR_H
#define NSCR_H
#ifndef TMUX_H
#define TMUX_H
#include <sys/param.h>
#include <sys/tree.h>
@ -26,9 +26,11 @@
#include <poll.h>
#include <stdarg.h>
#include <stdio.h>
#include <termios.h>
#include "array.h"
extern cc_t ttydefchars[];
extern char *__progname;
#define MAXNAMELEN 32

View File

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.6 2007-09-19 16:00:55 nicm Exp $ */
/* $Id: window.c,v 1.7 2007-09-20 09:43:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -24,7 +24,6 @@
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#define TTYDEFCHARS
#include <termios.h>
#include <unistd.h>
#include <util.h>
@ -58,6 +57,7 @@ window_create(const char *cmd, u_int sx, u_int sy)
struct window *w;
struct winsize ws;
struct termios tio;
struct sigaction act;
int fd, mode;
char pid[16], *ptr, *name;
@ -84,6 +84,29 @@ window_create(const char *cmd, u_int sx, u_int sy)
fatal("setenv failed");
log_close();
memset(&act, 0, sizeof act);
sigemptyset(&act.sa_mask);
act.sa_handler = SIG_DFL;
if (sigaction(SIGPIPE, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGUSR1, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGUSR2, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGINT, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGTSTP, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGQUIT, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGWINCH, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGTERM, &act, NULL) != 0)
fatal("sigaction failed");
if (sigaction(SIGCHLD, &act, NULL) != 0)
fatal("sigaction failed");
execl(_PATH_BSHELL, "sh", "-c", cmd, (char *) NULL);
fatal("execl failed");
}