version 1.102, 2001/09/16 14:46:54 |
version 1.103, 2001/10/06 00:36:42 |
|
|
/* Make the pseudo tty our controlling tty. */ |
/* Make the pseudo tty our controlling tty. */ |
pty_make_controlling_tty(&ttyfd, s->tty); |
pty_make_controlling_tty(&ttyfd, s->tty); |
|
|
/* Redirect stdin from the pseudo tty. */ |
/* Redirect stdin/stdout/stderr from the pseudo tty. */ |
if (dup2(ttyfd, fileno(stdin)) < 0) |
if (dup2(ttyfd, 0) < 0) |
error("dup2 stdin failed: %.100s", strerror(errno)); |
error("dup2 stdin: %s", strerror(errno)); |
|
if (dup2(ttyfd, 1) < 0) |
/* Redirect stdout to the pseudo tty. */ |
error("dup2 stdout: %s", strerror(errno)); |
if (dup2(ttyfd, fileno(stdout)) < 0) |
if (dup2(ttyfd, 2) < 0) |
error("dup2 stdin failed: %.100s", strerror(errno)); |
error("dup2 stderr: %s", strerror(errno)); |
|
|
/* Redirect stderr to the pseudo tty. */ |
|
if (dup2(ttyfd, fileno(stderr)) < 0) |
|
error("dup2 stdin failed: %.100s", strerror(errno)); |
|
|
|
/* Close the extra descriptor for the pseudo tty. */ |
/* Close the extra descriptor for the pseudo tty. */ |
close(ttyfd); |
close(ttyfd); |