aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES3
-rw-r--r--TODO1
-rw-r--r--local.c15
-rw-r--r--tmux.c3
-rw-r--r--tmux.h8
-rw-r--r--window.c27
6 files changed, 44 insertions, 13 deletions
diff --git a/CHANGES b/CHANGES
index 3fd2402f..84c45963 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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 $
diff --git a/TODO b/TODO
index 32ef1237..d5edf195 100644
--- a/TODO
+++ b/TODO
@@ -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
diff --git a/local.c b/local.c
index 3ec2ee51..8ba0c340 100644
--- a/local.c
+++ b/local.c
@@ -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");
diff --git a/tmux.c b/tmux.c
index 00b68246..f6515bab 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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;
diff --git a/tmux.h b/tmux.h
index 61365695..8580fc6f 100644
--- a/tmux.h
+++ b/tmux.h
@@ -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
diff --git a/window.c b/window.c
index db854f63..95a8bf21 100644
--- a/window.c
+++ b/window.c
@@ -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");
}