]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_dbg.c
add printf-like _DEBUGF() function for debugging, too
[16.git] / src / lib / 16_dbg.c
index be2c1d2626257d35fa7a626390de851d46b47bae..2215c42002c2acaa5ac9de10655db74ac1efa3a7 100644 (file)
@@ -3,6 +3,10 @@
 
 // TODO: Could we also provide a build mode to emit debug to the "Bochs E9 hack?"
 #ifdef DEBUGSERIAL
+# include <stdarg.h>
+# include <stdlib.h>
+# include <stdio.h>
+
 unsigned char _DEBUG_INITed = 0;
 struct info_8250 *_DEBUG_uart = NULL;
 
@@ -57,5 +61,16 @@ void _DEBUG(const char *msg) {
                }
        }
 }
+
+static char _DEBUGF_TMP[256];
+
+void _DEBUGF(const char *fmt,...) {
+       va_list va;
+
+       va_start(va,fmt);
+       vsnprintf(_DEBUGF_TMP,sizeof(_DEBUGF_TMP),fmt,va);
+       _DEBUG(_DEBUGF_TMP);
+       va_end(va);
+}
 #endif