From 0a1574bb1347f856524014ef23cb2d686361075c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 1 Jul 2010 00:47:49 +0000 Subject: 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 Signed-off-by: Blue Swirl --- os-win32.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'os-win32.c') diff --git a/os-win32.c b/os-win32.c index d98fd77c12..dd46bf459d 100644 --- a/os-win32.c +++ b/os-win32.c @@ -33,6 +33,21 @@ #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 */ -- cgit v1.2.1