diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-02-20 12:16:49 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-02-20 12:16:49 +0000 |
commit | 0ba795df8d5abd6f5fe25a73c6d2c0d4a8fbfff2 (patch) | |
tree | f03deb36d415c18f91a9d3708e3cc0feacd6a5dd /gpsmon.c | |
parent | 1072213a0d502adb3410b1422dae0feb74034145 (diff) | |
download | gpsd-0ba795df8d5abd6f5fe25a73c6d2c0d4a8fbfff2.tar.gz |
Various small cleanups and sanity checks.
Diffstat (limited to 'gpsmon.c')
-rw-r--r-- | gpsmon.c | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -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); } } |