diff options
author | H. Peter Anvin <hpa@zytor.com> | 2011-06-20 21:19:17 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-05-18 16:03:19 -0700 |
commit | df61c3b05b3a42b4202b74c1239576103b153e50 (patch) | |
tree | badacb794dfb5c378fe5167b7e61eea930ef1b74 | |
parent | c675f30d78e438f68ffe0254b24f5b9ecf5ac399 (diff) | |
download | syslinux-df61c3b05b3a42b4202b74c1239576103b153e50.tar.gz syslinux-df61c3b05b3a42b4202b74c1239576103b153e50.tar.xz syslinux-df61c3b05b3a42b4202b74c1239576103b153e50.zip |
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 <hpa@zytor.com>
Resolved Conflicts:
com32/lib/dprintf.c
com32/lib/vdprintf.c
-rw-r--r-- | com32/include/dprintf.h | 20 | ||||
-rw-r--r-- | com32/lib/dprintf.c | 5 | ||||
-rw-r--r-- | com32/lib/vdprintf.c | 6 |
3 files changed, 21 insertions, 10 deletions
diff --git a/com32/include/dprintf.h b/com32/include/dprintf.h index 30a21ada..4bdf7a76 100644 --- a/com32/include/dprintf.h +++ b/com32/include/dprintf.h @@ -7,15 +7,29 @@ #ifdef DEBUG -#include <stdio.h> +# include <stdio.h> +# 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 869f07f0..4d80204c 100644 --- a/com32/lib/dprintf.c +++ b/com32/lib/dprintf.c @@ -4,11 +4,9 @@ #include <stdio.h> #include <stdarg.h> - -#ifdef DEBUG - #include <dprintf.h> +#ifndef dprintf void dprintf(const char *format, ...) { va_list ap; @@ -17,5 +15,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 d4dc9743..a48f2ebc 100644 --- a/com32/lib/vdprintf.c +++ b/com32/lib/vdprintf.c @@ -2,8 +2,6 @@ * vdprintf.c */ -#ifdef DEBUG - #include <stdio.h> #include <string.h> #include <stdarg.h> @@ -14,6 +12,8 @@ #include <dprintf.h> +#ifndef vdprintf + #define BUFFER_SIZE 4096 enum serial_port_regs { @@ -115,4 +115,4 @@ void vdprintf(const char *format, va_list ap) debug_putc(*p++); } -#endif /* DEBUG */ +#endif /* vdprintf */ |