aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term/rcstart.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-09-21 01:11:28 +0000
committerrsc <devnull@localhost>2004-09-21 01:11:28 +0000
commitc6687d4591964cb13df87f55ec4770e778a4a55c (patch)
treeee669a419904e929ae8ae54fd04c2bb41b5a57b1 /src/cmd/9term/rcstart.c
parent3d5e34e146b5ba5c973230abb624ce9126024569 (diff)
downloadplan9port-c6687d4591964cb13df87f55ec4770e778a4a55c.tar.gz
plan9port-c6687d4591964cb13df87f55ec4770e778a4a55c.tar.bz2
plan9port-c6687d4591964cb13df87f55ec4770e778a4a55c.zip
Continue the pthreads torture.
Diffstat (limited to 'src/cmd/9term/rcstart.c')
-rw-r--r--src/cmd/9term/rcstart.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c
index 7ee49350..ddaadb56 100644
--- a/src/cmd/9term/rcstart.c
+++ b/src/cmd/9term/rcstart.c
@@ -3,6 +3,25 @@
#include <libc.h>
#include "term.h"
+static void
+sys(char *buf)
+{
+ char buf2[100];
+ char *f[20];
+ int nf, pid;
+
+ strcpy(buf2, buf);
+ nf = tokenize(buf2, f, nelem(f));
+ f[nf] = nil;
+ switch(pid = fork()){
+ case 0:
+ execvp(f[0], f);
+ _exits("oops");
+ default:
+ waitpid();
+ }
+}
+
int
rcstart(int argc, char **argv, int *pfd, int *tfd)
{
@@ -33,11 +52,14 @@ rcstart(int argc, char **argv, int *pfd, int *tfd)
dup(sfd, 0);
dup(sfd, 1);
dup(sfd, 2);
- system("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'");
+ sys("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'");
if(noecho)
- system("stty -echo");
+ sys("stty -echo");
for(i=3; i<100; i++)
close(i);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGHUP, SIG_DFL);
+ signal(SIGTERM, SIG_DFL);
execvp(argv[0], argv);
fprint(2, "exec %s failed: %r\n", argv[0]);
_exits("oops");