summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-09-29 01:42:45 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-09-29 01:46:53 -0400
commit4361ec2d89bdf451602d659ddfd0fb9a79c178a2 (patch)
treeaf067d1d7614a9e67f449eec933ba3347cde10b0 /gpsmon.c
parenta77b95b57475c2856707e91b197f8aaa8e5eb407 (diff)
downloadgpsd-4361ec2d89bdf451602d659ddfd0fb9a79c178a2.tar.gz
Change gpsd_report to no longer use a global. All regression tests pass.
This is a large, ugly change. But without it we can't troubleshoot the ICP/IP-source initialization bug properly - colliding definitions of gpsd_report() were interfering with error reporting early in gpsd runs. More cleanup work remains to be done, but at least this is working.
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gpsmon.c b/gpsmon.c
index 1f421960..93134eed 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -158,7 +158,7 @@ static void visibilize(/*@out@*/char *buf2, size_t len, const char *buf)
0x00ff & (unsigned)*sp);
}
-void gpsd_report(int errlevel, const char *fmt, ...)
+void gpsd_report(const int debuglevel, const int errlevel, const char *fmt, ...)
/* our version of the logger */
{
char buf[BUFSIZ];
@@ -198,7 +198,7 @@ void gpsd_report(int errlevel, const char *fmt, ...)
(void)strlcpy(buf, "gpsd:", BUFSIZ);
(void)strncat(buf, err_str, BUFSIZ - strlen(buf) );
- if (errlevel <= context.debug && packetwin != NULL) {
+ if (errlevel <= debuglevel && packetwin != NULL) {
char buf2[BUFSIZ];
va_list ap;
va_start(ap, fmt);
@@ -243,7 +243,7 @@ static ssize_t readpkt(void)
/* conditional prevents mask dumper from eating CPU */
if (context.debug >= LOG_DATA)
- gpsd_report(LOG_DATA,
+ gpsd_report(context.debug, LOG_DATA,
"packet mask = %s\n",
gps_maskdump(session.gpsdata.set));
@@ -598,7 +598,7 @@ int main(int argc, char **argv)
(void)strlcpy(session.gpsdata.dev.path, argv[optind],
sizeof(session.gpsdata.dev.path));
if (gpsd_activate(&session) == -1) {
- gpsd_report(LOG_ERROR,
+ gpsd_report(context.debug, LOG_ERROR,
"activation of device %s failed, errno=%d\n",
session.gpsdata.dev.path, errno);
exit(EXIT_FAILURE);