summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 5223f0ce..42c6be39 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -49,15 +49,14 @@ static void visibilize(/*@out@*/char *buf2, size_t len, const char *buf)
0x00ff & (unsigned)*sp);
}
-void gpsd_report(const int debuglevel, const int errlevel,
- const char *fmt, ...)
+void gpsd_labeled_report(const int debuglevel, const int errlevel,
+ const char *label, const char *fmt, va_list ap)
/* assemble command in printf(3) style, use stderr or syslog */
{
#ifndef SQUELCH_ENABLE
if (errlevel <= debuglevel) {
char buf[BUFSIZ], buf2[BUFSIZ];
char *err_str;
- va_list ap;
#if defined(PPS_ENABLE)
/*@ -unrecog (splint has no pthread declarations as yet) @*/
@@ -96,12 +95,9 @@ void gpsd_report(const int debuglevel, const int errlevel,
err_str = "UNK: ";
}
- (void)strlcpy(buf, "gpsd:", sizeof(buf));
+ (void)strlcpy(buf, label, sizeof(buf));
(void)strncat(buf, err_str, sizeof(buf) - 1 - strlen(buf));
- va_start(ap, fmt);
- (void)vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt,
- ap);
- va_end(ap);
+ (void)vsnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), fmt, ap);
visibilize(buf2, sizeof(buf2), buf);