diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 06:28:38 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-09-29 06:28:38 -0400 |
commit | f628764ea400bb6e14342908ca595a0c91e5c5ab (patch) | |
tree | d154b1afc040d5be58f4e932e2f1774ed88a8859 /libgpsd_core.c | |
parent | f6953c4bed4ee5bb010f52f689258825b7a0d8e5 (diff) | |
download | gpsd-f628764ea400bb6e14342908ca595a0c91e5c5ab.tar.gz |
Properly label debug reports from different programs.
All regression tests pass.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r-- | libgpsd_core.c | 12 |
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); |