summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-02-20 12:16:49 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-02-20 12:16:49 +0000
commit0ba795df8d5abd6f5fe25a73c6d2c0d4a8fbfff2 (patch)
treef03deb36d415c18f91a9d3708e3cc0feacd6a5dd /gpsmon.c
parent1072213a0d502adb3410b1422dae0feb74034145 (diff)
downloadgpsd-0ba795df8d5abd6f5fe25a73c6d2c0d4a8fbfff2.tar.gz
Various small cleanups and sanity checks.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 0e30f549..1a5df0c3 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -447,17 +447,23 @@ int main (int argc, char **argv)
if ((*trial)->driver == session.device_type)
newobject = trial;
if (newobject) {
- if (active != NULL) {
- (*active)->wrap();
- (void)delwin(devicewin);
+ if (LINES < (*newobject)->min_y || COLS < (*newobject)->min_x) {
+ monitor_complain("New type requires %dx%d screen",
+ (*newobject)->min_x, (*newobject)->min_x);
+ } else {
+ if (active != NULL) {
+ (*active)->wrap();
+ (void)delwin(devicewin);
+ }
+ active = newobject;
+ devicewin = newwin((*active)->min_y+1,
+ (*active)->min_x+1,1,0);
+ if (!(*active)->initialize())
+ goto quit;
+ (void)wresize(packetwin, LINES-(*active)->min_y-1, 80);
+ (void)mvwin(packetwin, (*active)->min_y+1, 0);
+ (void)wsetscrreg(packetwin, 0, LINES-(*active)->min_y-2);
}
- active = newobject;
- devicewin = newwin((*active)->min_y+1, (*active)->min_x+1,1,0);
- if (!(*active)->initialize())
- goto quit;
- (void)wresize(packetwin, LINES-(*active)->min_y-1, 80);
- (void)mvwin(packetwin, (*active)->min_y+1, 0);
- (void)wsetscrreg(packetwin, 0, LINES-(*active)->min_y-2);
}
}