[syslinux:elflink] dprintf: Print to stdout as well as serial ports

syslinux-bot for Matt Fleming matt.fleming at linux.intel.com
Mon Mar 14 15:33:39 PDT 2011


Commit-ID:  b89150e76d231626ee09aba865d8b4cd1ea7b57e
Gitweb:     http://syslinux.zytor.com/commit/b89150e76d231626ee09aba865d8b4cd1ea7b57e
Author:     Matt Fleming <matt.fleming at linux.intel.com>
AuthorDate: Tue, 8 Mar 2011 13:47:32 +0000
Committer:  Matt Fleming <matt.fleming at linux.intel.com>
CommitDate: Tue, 8 Mar 2011 19:08:40 +0000

dprintf: Print to stdout as well as serial ports

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);
 }



More information about the Syslinux-commits mailing list