summaryrefslogtreecommitdiffstats
path: root/os-win32.c
diff options
context:
space:
mode:
authorStefan Weil2010-07-01 02:47:49 +0200
committerBlue Swirl2010-08-15 11:45:28 +0200
commit0a1574bb1347f856524014ef23cb2d686361075c (patch)
tree80a6e67ae04dc919fc03855b19eb598640c990d7 /os-win32.c
parentDisable build of ivshmem on non-KVM systems (diff)
downloadqemu-0a1574bb1347f856524014ef23cb2d686361075c.tar.gz
qemu-0a1574bb1347f856524014ef23cb2d686361075c.tar.xz
qemu-0a1574bb1347f856524014ef23cb2d686361075c.zip
win32: Add missing function setenv
Mingw32 does not provide a declaration and implementation of function setenv (which is used in sdl.c), so this patch adds both. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'os-win32.c')
-rw-r--r--os-win32.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/os-win32.c b/os-win32.c
index d98fd77c12..dd46bf459d 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -34,6 +34,21 @@
#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 */
typedef struct PollingEntry {