From: H. Peter Anvin Date: Tue, 21 Jun 2011 04:19:17 +0000 (-0700) Subject: dprintf: add the ability to log to stdio X-Git-Tag: syslinux-4.05-pre2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24ea7f3ece30a586a149dfb60c49b6a6f92dd17e;p=platform%2Fupstream%2Fsyslinux.git dprintf: add the ability to log to stdio Add the ability to redirect dprintf to stdio when there is no other choice. Signed-off-by: H. Peter Anvin --- diff --git a/com32/include/dprintf.h b/com32/include/dprintf.h index 30a21ad..4bdf7a7 100644 --- a/com32/include/dprintf.h +++ b/com32/include/dprintf.h @@ -7,15 +7,29 @@ #ifdef DEBUG -#include +# include +# ifdef DEBUG_STDIO +# define dprintf printf +# define vdprintf vprintf +# else void dprintf(const char *, ...); void vdprintf(const char *, va_list); +# endif + +# if DEBUG >= 2 +/* Really verbose debugging... */ +# define dprintf2 dprintf +# define vdprintf2 vdprintf +# else +# define dprintf2(fmt, ...) ((void)(0)) +# define vdprintf2(fmt, ap) ((void)(0)) +# endif #else -#define dprintf(fmt, ...) ((void)(0)) -#define vdprintf(fmt, ap) ((void)(0)) +# define dprintf(fmt, ...) ((void)(0)) +# define vdprintf(fmt, ap) ((void)(0)) #endif /* DEBUG */ diff --git a/com32/lib/dprintf.c b/com32/lib/dprintf.c index 900c0a4..aad1174 100644 --- a/com32/lib/dprintf.c +++ b/com32/lib/dprintf.c @@ -9,6 +9,7 @@ #define DEBUG 1 #include +#ifndef dprintf void dprintf(const char *format, ...) { va_list ap; @@ -17,3 +18,4 @@ void dprintf(const char *format, ...) vdprintf(format, ap); va_end(ap); } +#endif diff --git a/com32/lib/vdprintf.c b/com32/lib/vdprintf.c index d74f278..c1f90a6 100644 --- a/com32/lib/vdprintf.c +++ b/com32/lib/vdprintf.c @@ -14,6 +14,8 @@ #define DEBUG 1 #include +#ifndef vdprintf + #define BUFFER_SIZE 4096 enum serial_port_regs { @@ -114,3 +116,5 @@ void vdprintf(const char *format, va_list ap) while (rv--) debug_putc(*p++); } + +#endif /* vdprintf */