]> git.proxmox.com Git - mirror_qemu.git/blobdiff - os-win32.c
win32: Set unbuffered stdout
[mirror_qemu.git] / os-win32.c
index d98fd77c12b04107383e10a33d73ef10897402bc..3c6f50fa9470ded15dc8a8380bdc154dd76d8733 100644 (file)
 #include "sysemu.h"
 #include "qemu-options.h"
 
+/***********************************************************/
+/* Functions missing in mingw */
+
+int setenv(const char *name, const char *value, int overwrite)
+{
+    int result = 0;
+    if (overwrite || !getenv(name)) {
+        size_t length = strlen(name) + strlen(value) + 2;
+        char *string = qemu_malloc(length);
+        snprintf(string, length, "%s=%s", name, value);
+        result = putenv(string);
+    }
+    return result;
+}
+
 /***********************************************************/
 /* Polling handling */
 
@@ -206,6 +221,12 @@ char *os_find_datadir(const char *argv0)
     return NULL;
 }
 
+void os_set_line_buffering(void)
+{
+    setbuf(stdout, NULL);
+    setbuf(stderr, NULL);
+}
+
 /*
  * Parse OS specific command line options.
  * return 0 if option handled, -1 otherwise