]> err.no Git - util-linux/commitdiff
script: don't flush input when starting script
authorAndrew McGill <list2008@lunch.za.net>
Tue, 29 Jul 2008 21:56:05 +0000 (23:56 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 5 Aug 2008 10:39:01 +0000 (12:39 +0200)
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 <andrew@lunch.za.net>
misc-utils/script.c

index 45a9c3e79ccac0c50c1a769a1714bfe300b346ea..12ea43a82ba4cb885dacf27126fb9ed5396b5f9e 100644 (file)
@@ -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();