Date: Wed, 4 Oct 2017 11:38:52 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r324262 - stable/11/usr.bin/resizewin Message-ID: <201710041138.v94BcqrX003827@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Wed Oct 4 11:38:52 2017 New Revision: 324262 URL: https://svnweb.freebsd.org/changeset/base/324262 Log: MFC r320360: Make resizewin(1) do flushing by using TCSAFLUSH instead of TCSANOW followed by tcflush(3). This works just as well and is more elegant. Modified: stable/11/usr.bin/resizewin/resizewin.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/resizewin/resizewin.c ============================================================================== --- stable/11/usr.bin/resizewin/resizewin.c Wed Oct 4 11:35:04 2017 (r324261) +++ stable/11/usr.bin/resizewin/resizewin.c Wed Oct 4 11:38:52 2017 (r324262) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710041138.v94BcqrX003827>