[syslinux] [PATCH 01/12] dprintf: Print to stdout as well as serial ports

Matt Fleming matt at console-pimps.org
Wed Mar 9 08:00:12 PST 2011


From: Matt Fleming <matt.fleming at linux.intel.com>

The intention here is to make dprintf the de-facto function for
printing all debugging information. As such, it's useful to print to
the serial ports and stdout so that developers are not required to
hook up a serial port to view output.

Signed-off-by: Matt Fleming <matt.fleming at linux.intel.com>
---
 com32/lib/vdprintf.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/com32/lib/vdprintf.c b/com32/lib/vdprintf.c
index d74f278..76da012 100644
--- a/com32/lib/vdprintf.c
+++ b/com32/lib/vdprintf.c
@@ -49,13 +49,13 @@ static void debug_putc(char c)
 
 void vdprintf(const char *format, va_list ap)
 {
-    int rv;
+    int rv, _rv;
     char buffer[BUFFER_SIZE];
     char *p;
     static bool debug_init = false;
     static bool debug_ok   = false;
 
-    rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
+    _rv = rv = vsnprintf(buffer, BUFFER_SIZE, format, ap);
 
     if (rv < 0)
 	return;
@@ -113,4 +113,6 @@ void vdprintf(const char *format, va_list ap)
     p = buffer;
     while (rv--)
 	debug_putc(*p++);
+
+    _fwrite(buffer, _rv, stdout);
 }
-- 
1.7.4




More information about the Syslinux mailing list