util: Also output messages to stderr on windows.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 20 Feb 2009 14:14:19 +0000 (14:14 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 20 Feb 2009 14:14:19 +0000 (14:14 +0000)
When there is a console attached, and no debugger attached.

src/gallium/auxiliary/util/u_debug.c

index 7f2a113dead71cbc1e0f397992c459ff93f97dc9..0ddda69884922f962d3b2ef3c18e83fda19c2e07 100644 (file)
@@ -50,6 +50,7 @@
 #define WIN32_LEAN_AND_MEAN      // Exclude rarely-used stuff from Windows headers
 #endif
 #include <windows.h>
+#include <stdio.h>
 
 #else
 
@@ -106,6 +107,11 @@ void _debug_vprintf(const char *format, va_list ap)
       OutputDebugStringA(buf);
       buf[0] = '\0';
    }
+   
+   if(GetConsoleWindow() && !IsDebuggerPresent()) {
+      vfprintf(stderr, format, ap);
+   }
+   
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_CE)
    wchar_t *wide_format;
    long wide_str_len;