From a889733e2bef5efaede4880541947f24da40c888 Mon Sep 17 00:00:00 2001 From: skarg Date: Tue, 15 Jul 2008 14:53:04 +0000 Subject: [PATCH] Added fprintf function. --- bacnet-stack/include/debug.h | 6 ++++-- bacnet-stack/src/debug.c | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/bacnet-stack/include/debug.h b/bacnet-stack/include/debug.h index b8e8f27f..6c1efada 100644 --- a/bacnet-stack/include/debug.h +++ b/bacnet-stack/include/debug.h @@ -40,9 +40,11 @@ #include "bacdef.h" #if DEBUG_ENABLED -void debug_printf(char *fmt, ...); +void debug_printf(const char * format, ...); +void debug_fprintf(FILE * stream, const char * format, ...) #else -static void debug_printf(char *fmt, ...) {} +static void debug_printf(const char * format, ...) {} +static void debug_fprintf(FILE * stream, const char * format, ...) {} #endif #endif diff --git a/bacnet-stack/src/debug.c b/bacnet-stack/src/debug.c index 016cf892..79dee238 100644 --- a/bacnet-stack/src/debug.c +++ b/bacnet-stack/src/debug.c @@ -38,14 +38,26 @@ #include /* Standard Library */ #include -void debug_printf(char *fmt, ...) +void debug_printf(const char * format, ...) { va_list ap; - va_start(ap, fmt); - vfprintf(stdout, fmt, ap); + va_start(ap, format); + vfprintf(stdout, format, ap); va_end(ap); fflush(stdout); return; } + +void debug_fprintf(FILE * stream, const char * format, ...) +{ + va_list ap; + + va_start(ap, format); + vfprintf(stream, format, ap); + va_end(ap); + fflush(stream); + + return; +}