diff options
author | rsc <devnull@localhost> | 2004-04-16 15:27:29 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-16 15:27:29 +0000 |
commit | a2705f207ff006c07c72081897ec4a6ca22ef269 (patch) | |
tree | 32babd989cd836072be4bb1ef526340fd0186d82 /src/cmd/9term/rcstart.c | |
parent | aba09191af8012bc7d6a1b998ac937875f728d0c (diff) | |
download | plan9port-a2705f207ff006c07c72081897ec4a6ca22ef269.tar.gz plan9port-a2705f207ff006c07c72081897ec4a6ca22ef269.tar.bz2 plan9port-a2705f207ff006c07c72081897ec4a6ca22ef269.zip |
make echoing work.
Diffstat (limited to 'src/cmd/9term/rcstart.c')
-rw-r--r-- | src/cmd/9term/rcstart.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/cmd/9term/rcstart.c b/src/cmd/9term/rcstart.c index 499c5918..4b324830 100644 --- a/src/cmd/9term/rcstart.c +++ b/src/cmd/9term/rcstart.c @@ -6,17 +6,10 @@ #include <signal.h> #include "term.h" -/* - * Somehow we no longer automatically exit - * when the shell exits; hence the SIGCHLD stuff. - * Something that can be fixed? Axel. - */ -static int pid; - int rcstart(int argc, char **argv, int *pfd, int *tfd) { - int fd[2]; + int fd[2], i, pid; char *xargv[3]; char slave[256]; int sfd; @@ -36,7 +29,6 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) fd[0] = fd[1] = -1; if(getpts(fd, slave) < 0) sysfatal("getpts: %r\n"); - switch(pid = fork()) { case 0: putenv("TERM", "9term"); @@ -44,7 +36,9 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) dup(sfd, 0); dup(sfd, 1); dup(sfd, 2); - system("stty tabs -onlcr -echo erase '^h' intr '^?'"); + system("stty tabs -onlcr onocr icanon echo erase '^h' intr '^?'"); + for(i=3; i<100; i++) + close(i); execvp(argv[0], argv); fprint(2, "exec %s failed: %r\n", argv[0]); _exits("oops"); @@ -54,10 +48,11 @@ rcstart(int argc, char **argv, int *pfd, int *tfd) break; } *pfd = fd[1]; - if(tfd) - *tfd = fd[0]; - else - close(fd[0]); + close(fd[0]); + if(tfd){ + if((*tfd = open(slave, OREAD)) < 0) + sysfatal("parent open %s: %r", slave); + } return pid; } |