]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - con.c
Added test for variadic arguments
[xonotic/gmqcc.git] / con.c
diff --git a/con.c b/con.c
index bfe3a23c72650a60b7285f3eaba6618e2a1ede4c..8073a5723d71286568e5d0c164d3e34059af924f 100644 (file)
--- a/con.c
+++ b/con.c
@@ -272,7 +272,7 @@ int con_change(const char *out, const char *err) {
     con_close();
     
     if (GMQCC_IS_DEFINE((FILE*)out)) {
-        console.handle_out = (((FILE*)err) == stdout) ? stdout : stderr;
+        console.handle_out = (((FILE*)out) == stdout) ? stdout : stderr;
         con_enablecolor();
     } else if (!(console.handle_out = fopen(out, "w"))) return 0;
     
@@ -281,6 +281,10 @@ int con_change(const char *out, const char *err) {
         con_enablecolor();
     } else if (!(console.handle_err = fopen(err, "w"))) return 0;
     
+    // no buffering
+    setvbuf(console.handle_out, NULL, _IONBF, 0);
+    setvbuf(console.handle_err, NULL, _IONBF, 0);
+    
     return 1;
 }