diff options
author | Karel Zak | 2006-12-07 00:25:48 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:48 +0100 |
commit | 364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed (patch) | |
tree | c60dfad813ca42bf619fe2ac8ce893d2331e508f /misc-utils/script.c | |
parent | Imported from util-linux-2.11b tarball. (diff) | |
download | kernel-qcow2-util-linux-364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed.tar.gz kernel-qcow2-util-linux-364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed.tar.xz kernel-qcow2-util-linux-364cda4857f7dd5e2b4e2eb7583a2eaa279ef4ed.zip |
Imported from util-linux-2.11f tarball.
Diffstat (limited to 'misc-utils/script.c')
-rw-r--r-- | misc-utils/script.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/misc-utils/script.c b/misc-utils/script.c index 951fc763d..de158cd35 100644 --- a/misc-utils/script.c +++ b/misc-utils/script.c @@ -67,6 +67,7 @@ void finish(int); void done(void); void fail(void); +void resize(int); void fixtty(void); void getmaster(void); void getslave(void); @@ -189,7 +190,8 @@ main(int argc, char **argv) { dooutput(); else doshell(); - } + } else + (void) signal(SIGWINCH, resize); doinput(); return 0; @@ -201,9 +203,7 @@ doinput() { char ibuf[BUFSIZ]; (void) fclose(fscript); -#ifdef HAVE_openpty - (void) close(slave); -#endif + while ((cc = read(0, ibuf, BUFSIZ)) > 0) (void) write(master, ibuf, cc); done(); @@ -226,6 +226,15 @@ finish(int dummy) { } void +resize(int dummy) { + /* transmit window change information to the child */ + (void) ioctl(0, TIOCGWINSZ, (char *)&win); + (void) ioctl(slave, TIOCSWINSZ, (char *)&win); + + kill(child, SIGWINCH); +} + +void dooutput() { register int cc; time_t tvec; |