diff options
author | Eugene Sandulenko | 2006-01-29 02:44:30 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-01-29 02:44:30 +0000 |
commit | 052a42f89fe86fa51bd4c11736f4056fbb3e801e (patch) | |
tree | d9044f46dded6743a9936090211d834f569c100b /base | |
parent | 011d75621d16515a99c3c39a675338e19cd7da85 (diff) | |
download | scummvm-rg350-052a42f89fe86fa51bd4c11736f4056fbb3e801e.tar.gz scummvm-rg350-052a42f89fe86fa51bd4c11736f4056fbb3e801e.tar.bz2 scummvm-rg350-052a42f89fe86fa51bd4c11736f4056fbb3e801e.zip |
Added new debugN() function which doesn't append newline.
svn-id: r20285
Diffstat (limited to 'base')
-rw-r--r-- | base/main.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
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; |