diff options
author | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-06-26 13:14:41 +0000 |
---|---|---|
committer | Edward Tomasz Napierala <trasz@FreeBSD.org> | 2017-06-26 13:14:41 +0000 |
commit | dd99f75ce62a238a17373fef9635e0b4b8e4965e (patch) | |
tree | 7075ac95fd65a4df0ed471deb8061cf39bb86f42 /usr.bin/resizewin | |
parent | 6a3450e17844175e68319d0033e99226ca26c337 (diff) | |
download | src-test-dd99f75ce62a238a17373fef9635e0b4b8e4965e.tar.gz src-test-dd99f75ce62a238a17373fef9635e0b4b8e4965e.zip |
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
Notes
Notes:
svn path=/head/; revision=320360
Diffstat (limited to 'usr.bin/resizewin')
-rw-r--r-- | usr.bin/resizewin/resizewin.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/usr.bin/resizewin/resizewin.c b/usr.bin/resizewin/resizewin.c index d86189ffe7283..42290faf33aa6 100644 --- a/usr.bin/resizewin/resizewin.c +++ b/usr.bin/resizewin/resizewin.c @@ -91,21 +91,16 @@ 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; goto out; |