summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-09 08:35:36 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-09 08:35:36 -0400
commitf194610e55fd8357567725d31c326ddea7c64922 (patch)
treec114c369c8c0e5b17c0f38cc13bbc855c77dba73 /gpsmon.c
parent0a8ab2f0e0597841f932baeba7c5ae80701be0b2 (diff)
downloadgpsd-f194610e55fd8357567725d31c326ddea7c64922.tar.gz
promptlen needs to ne gloal for monitor_complain to work.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 7abcdcfe..dce022d0 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -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 @*/