diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-09 08:35:36 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-09 08:35:36 -0400 |
commit | f194610e55fd8357567725d31c326ddea7c64922 (patch) | |
tree | c114c369c8c0e5b17c0f38cc13bbc855c77dba73 /gpsmon.c | |
parent | 0a8ab2f0e0597841f932baeba7c5ae80701be0b2 (diff) | |
download | gpsd-f194610e55fd8357567725d31c326ddea7c64922.tar.gz |
promptlen needs to ne gloal for monitor_complain to work.
Diffstat (limited to 'gpsmon.c')
-rw-r--r-- | gpsmon.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -53,6 +53,7 @@ static WINDOW *statwin, *cmdwin; /*@null@*/ static WINDOW *packetwin; /*@null@*/ static FILE *logfile; static char *type_name; +static size_t promptlen = 0; #ifdef PASSTHROUGH_ENABLE /* no methods, it's all device window */ @@ -367,7 +368,7 @@ void monitor_complain(const char *fmt, ...) { va_list ap; assert(cmdwin!=NULL); - (void)wmove(cmdwin, 0, (int)strlen(type_name) + 2); + (void)wmove(cmdwin, 0, (int)promptlen); (void)wclrtoeol(cmdwin); (void)wattrset(cmdwin, A_BOLD | A_BLINK); va_start(ap, fmt); @@ -443,7 +444,7 @@ static bool switch_type(const struct gps_type_t *devtype) return false; } -static bool do_command(size_t promptlen) +static bool do_command(void) { #ifdef RECONFIGURE_ENABLE unsigned int v; @@ -721,7 +722,7 @@ static bool do_command(size_t promptlen) #endif /* CONTROLSEND_ENABLE */ default: - monitor_complain("Unknown command"); + monitor_complain("Unknown command '%c'", line[0]); break; } @@ -750,7 +751,6 @@ int main(int argc, char **argv) int bailout = 0, matches = 0; bool nmea = false; ssize_t len; - size_t promptlen = 0; /*@ -observertrans @*/ (void)putenv("TZ=UTC"); // for ctime() @@ -1019,7 +1019,7 @@ int main(int argc, char **argv) break; if (FD_ISSET(0, &select_set)) - if (!do_command(promptlen)) + if (!do_command()) goto quit; } /*@ +nullpass @*/ |