[PATCH]: script: don't flush input when starting script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 misc-utils/script.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/misc-utils/script.c b/misc-utils/script.c
index 45a9c3e..12ea43a 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();
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux