diff options
author | rsc <devnull@localhost> | 2004-12-26 21:37:31 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-12-26 21:37:31 +0000 |
commit | 60535a5ff621d2e0f1eb91a08c0e624cc6c76fbd (patch) | |
tree | c3bdc4a7c60d477c3bbbdf07b8e4896d27440086 /src/cmd/9term/rcstart.c | |
parent | f99790979b4a659d7f6e490fbb8b26d630804eed (diff) | |
download | plan9port-60535a5ff621d2e0f1eb91a08c0e624cc6c76fbd.tar.gz plan9port-60535a5ff621d2e0f1eb91a08c0e624cc6c76fbd.tar.bz2 plan9port-60535a5ff621d2e0f1eb91a08c0e624cc6c76fbd.zip |
make work with new thread library
Diffstat (limited to 'src/cmd/9term/rcstart.c')
-rw-r--r-- | src/cmd/9term/rcstart.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c index ddaadb56..1aa46dce 100644 --- a/src/cmd/9term/rcstart.c +++ b/src/cmd/9term/rcstart.c @@ -4,19 +4,24 @@ #include "term.h" static void -sys(char *buf) +sys(char *buf, int devnull) { char buf2[100]; char *f[20]; int nf, pid; + notedisable("sys: child"); strcpy(buf2, buf); nf = tokenize(buf2, f, nelem(f)); f[nf] = nil; switch(pid = fork()){ case 0: + close(1); + open("/dev/null", OREAD); + close(2); + open("/dev/null", OREAD); execvp(f[0], f); - _exits("oops"); + _exit(2); default: waitpid(); } @@ -43,18 +48,23 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) * fd0 is slave (tty), fd1 is master (pty) */ fd[0] = fd[1] = -1; - if(getpts(fd, slave) < 0) + if(getpts(fd, slave) < 0){ + exit(3); sysfatal("getpts: %r\n"); - switch(pid = fork()) { + } + notedisable("sys: window size change"); + pid = fork(); + switch(pid){ case 0: putenv("TERM", "9term"); sfd = childpty(fd, slave); dup(sfd, 0); dup(sfd, 1); dup(sfd, 2); - sys("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'"); + sys("stty tabs -onlcr icanon echo erase '^h' intr '^?'", 0); + sys("stty onocr", 1); /* not available on mac */ if(noecho) - sys("stty -echo"); + sys("stty -echo", 0); for(i=3; i<100; i++) close(i); signal(SIGINT, SIG_DFL); @@ -62,7 +72,7 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) signal(SIGTERM, SIG_DFL); execvp(argv[0], argv); fprint(2, "exec %s failed: %r\n", argv[0]); - _exits("oops"); + _exit(2); break; case -1: sysfatal("proc failed: %r"); |