svn commit: r317901 - head/usr.bin/resizewin
Edward Tomasz Napierala
trasz at FreeBSD.org
Sun May 7 09:19:44 UTC 2017
Author: trasz
Date: Sun May 7 09:19:42 2017
New Revision: 317901
URL: https://svnweb.freebsd.org/changeset/base/317901
Log:
Improve error reporting in resizewin(1).
Reviewed by: cem (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10624
Modified:
head/usr.bin/resizewin/resizewin.c
Modified: head/usr.bin/resizewin/resizewin.c
==============================================================================
--- head/usr.bin/resizewin/resizewin.c Sun May 7 08:02:28 2017 (r317900)
+++ head/usr.bin/resizewin/resizewin.c Sun May 7 09:19:42 2017 (r317901)
@@ -31,6 +31,7 @@
__FBSDID("$FreeBSD$");
#include <sys/ioctl.h>
#include <sys/time.h>
+#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@ -87,8 +88,7 @@ main(__unused int argc, __unused char **
gettimeofday(&now, NULL);
timersub(&now, &then, &now);
if (now.tv_sec >= 2) {
- fprintf(stderr, "\n\n\nTimeout reading from terminal\n");
- fprintf(stderr, "Read %d bytes, %s\n", cnt, data);
+ warnx("timeout reading from terminal");
err = 1;
goto out;
}
@@ -104,7 +104,7 @@ main(__unused int argc, __unused char **
cnt++;
if (cnt == sizeof(data) - 2) {
- fprintf(stderr, "Response too long\n");
+ warnx("response too long");
err = 1;
goto out;
}
@@ -113,7 +113,7 @@ main(__unused int argc, __unused char **
/* Parse */
if (sscanf(data, "\033[%hu;%huR", &w.ws_row, &w.ws_col) != 2) {
err = 1;
- fprintf(stderr, "Unable to parse response\n");
+ warnx("unable to parse response");
goto out;
}
More information about the svn-src-head
mailing list