From: Andrew McGill Date: Tue, 29 Jul 2008 21:56:05 +0000 (+0200) Subject: script: don't flush input when starting script X-Git-Tag: v2.15-rc1~426 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8c7a57b4fafb16a4cbf535c8e07066b20ed9551;p=thirdparty%2Futil-linux.git script: don't flush input when starting script script currently flushed the input buffer when starting up. This undocumented behaviour prevents typeahead when starting up (e.g. as part of .profile). Rather retain queued input. Don't discard queued output either. Signed-off-by: Andrew McGill --- diff --git a/misc-utils/script.c b/misc-utils/script.c index 45a9c3e79c..12ea43a82b 100644 --- a/misc-utils/script.c +++ b/misc-utils/script.c @@ -408,7 +408,7 @@ fixtty() { rtt = tt; cfmakeraw(&rtt); rtt.c_lflag &= ~ECHO; - (void) tcsetattr(0, TCSAFLUSH, &rtt); + (void) tcsetattr(0, TCSANOW, &rtt); } void @@ -432,7 +432,7 @@ done() { (void) fclose(fscript); (void) close(master); } else { - (void) tcsetattr(0, TCSAFLUSH, &tt); + (void) tcsetattr(0, TCSADRAIN, &tt); if (!qflg) printf(_("Script done, file is %s\n"), fname); } @@ -493,7 +493,7 @@ getslave() { perror(line); fail(); } - (void) tcsetattr(slave, TCSAFLUSH, &tt); + (void) tcsetattr(slave, TCSANOW, &tt); (void) ioctl(slave, TIOCSWINSZ, (char *)&win); #endif (void) setsid();