blob: 916c5f3344e0e60cd0580b992e0408433c5acf94 [file] [log] [blame]
David 'Digit' Turnerf816a752011-06-23 18:40:11 +02001#include <stdlib.h>
2#include <stdio.h>
3#include <string.h>
4
5#ifdef _WIN32
6int setenv(const char *name, const char *value, int overwrite)
7{
8 int result = 0;
9 if (overwrite || !getenv(name)) {
10 size_t length = strlen(name) + strlen(value) + 2;
11 char *string = malloc(length);
12 snprintf(string, length, "%s=%s", name, value);
13 result = putenv(string);
14 }
15 return result;
16}
17
18#endif