mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
3dcbf8f9ca
commit
0a1574bb13
2 changed files with 17 additions and 0 deletions
15
os-win32.c
15
os-win32.c
|
@ -33,6 +33,21 @@
|
||||||
#include "sysemu.h"
|
#include "sysemu.h"
|
||||||
#include "qemu-options.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 */
|
/* Polling handling */
|
||||||
|
|
||||||
|
|
2
osdep.h
2
osdep.h
|
@ -95,6 +95,8 @@ int qemu_create_pidfile(const char *filename);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int ffs(int i);
|
int ffs(int i);
|
||||||
|
|
||||||
|
int setenv(const char *name, const char *value, int overwrite);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
long tv_sec;
|
long tv_sec;
|
||||||
long tv_usec;
|
long tv_usec;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue