From 052a42f89fe86fa51bd4c11736f4056fbb3e801e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 29 Jan 2006 02:44:30 +0000 Subject: Added new debugN() function which doesn't append newline. svn-id: r20285 --- base/main.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 84b26599af..6c67fbe013 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -489,13 +489,15 @@ extern "C" int main(int argc, char *argv[]) { END_OF_MAIN(); #endif -static void debugHelper(char *buf) { +static void debugHelper(char *buf, bool caret = true) { #ifndef _WIN32_WCE - printf("%s\n", buf); + if (caret) + printf("%s\n", buf); #endif #if defined( USE_WINDBG ) - strcat(buf, "\n"); + if (caret) + strcat(buf, "\n"); #if defined( _WIN32_WCE ) TCHAR buf_unicode[1024]; MultiByteToWideChar(CP_ACP, 0, buf, strlen(buf) + 1, buf_unicode, sizeof(buf_unicode)); @@ -522,6 +524,20 @@ void CDECL debug(int level, const char *s, ...) { debugHelper(buf); } +void CDECL debugN(int level, const char *s, ...) { + char buf[STRINGBUFLEN]; + va_list va; + + if (level > gDebugLevel) + return; + + va_start(va, s); + vsnprintf(buf, STRINGBUFLEN, s, va); + va_end(va); + + debugHelper(buf, false); +} + void CDECL debug(const char *s, ...) { char buf[STRINGBUFLEN]; va_list va; -- cgit v1.2.3