aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/resizewin
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-05-07 12:08:41 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-05-07 12:08:41 +0000
commit31cf65bbf81cca60698681c85e34eeda143bf9ef (patch)
tree4ae006c4db7149a71c87238fa891572411bf3231 /usr.bin/resizewin
parent452bdaabb5ddd0cacae3d9067214c156d2bae4b8 (diff)
downloadsrc-31cf65bbf81cca60698681c85e34eeda143bf9ef.tar.gz
src-31cf65bbf81cca60698681c85e34eeda143bf9ef.zip
Notes
Diffstat (limited to 'usr.bin/resizewin')
-rw-r--r--usr.bin/resizewin/resizewin.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/resizewin/resizewin.c b/usr.bin/resizewin/resizewin.c
index 8bfa78608f48..89a2b1bc6374 100644
--- a/usr.bin/resizewin/resizewin.c
+++ b/usr.bin/resizewin/resizewin.c
@@ -52,11 +52,11 @@ main(__unused int argc, __unused char **argv)
{
struct termios old, new;
struct winsize w;
- int ret, fd, cnt, err;
+ int ret, fd, cnt, error;
char data[20];
struct timeval then, now;
- err = 0;
+ error = 0;
if ((fd = open("/dev/tty", O_RDWR | O_NONBLOCK)) == -1)
exit(1);
@@ -72,7 +72,7 @@ main(__unused int argc, __unused char **argv)
exit(1);
if (write(fd, query, sizeof(query)) != sizeof(query)) {
- err = 1;
+ error = 1;
goto out;
}
@@ -89,14 +89,14 @@ main(__unused int argc, __unused char **argv)
timersub(&now, &then, &now);
if (now.tv_sec >= 2) {
warnx("timeout reading from terminal");
- err = 1;
+ error = 1;
goto out;
}
usleep(20000);
continue;
}
- err = 1;
+ error = 1;
goto out;
}
if (data[cnt] == 'R')
@@ -105,25 +105,25 @@ main(__unused int argc, __unused char **argv)
cnt++;
if (cnt == sizeof(data) - 2) {
warnx("response too long");
- err = 1;
+ error = 1;
goto out;
}
}
/* Parse */
if (sscanf(data, "\033[%hu;%huR", &w.ws_row, &w.ws_col) != 2) {
- err = 1;
+ error = 1;
warnx("unable to parse response");
goto out;
}
/* Finally, what we want */
if (ioctl(fd, TIOCSWINSZ, &w) == -1)
- err = 1;
+ error = 1;
out:
/* Restore echo */
tcsetattr(fd, TCSANOW, &old);
close(fd);
- exit(err);
+ exit(error);
}