svn commit: r320360 - head/usr.bin/resizewin
Edward Tomasz Napierala
trasz at FreeBSD.org
Mon Jun 26 13:14:43 UTC 2017
Author: trasz
Date: Mon Jun 26 13:14:41 2017
New Revision: 320360
URL: https://svnweb.freebsd.org/changeset/base/320360
Log:
Make resizewin(1) do flushing by using TCSAFLUSH instead of TCSANOW
followed by tcflush(3). This works just as well and is more elegant.
Suggested by: bde
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Modified:
head/usr.bin/resizewin/resizewin.c
Modified: head/usr.bin/resizewin/resizewin.c
==============================================================================
--- head/usr.bin/resizewin/resizewin.c Mon Jun 26 13:11:21 2017 (r320359)
+++ head/usr.bin/resizewin/resizewin.c Mon Jun 26 13:14:41 2017 (r320360)
@@ -91,20 +91,15 @@ main(int argc, char **argv)
exit(0);
}
- /* Disable echo */
+ /* Disable echo, drain the input, and flush the output */
if (tcgetattr(fd, &old) == -1)
exit(1);
new = old;
new.c_cflag |= (CLOCAL | CREAD);
new.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
- if (tcsetattr(fd, TCSANOW, &new) == -1)
+ if (tcsetattr(fd, TCSAFLUSH, &new) == -1)
exit(1);
-
- /* Discard input received so far */
- error = tcflush(fd, TCIOFLUSH);
- if (error != 0)
- warn("tcflush");
if (write(fd, query, sizeof(query)) != sizeof(query)) {
error = 1;
More information about the svn-src-head
mailing list