summaryrefslogtreecommitdiff
path: root/win32/contrib/setenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/contrib/setenv.c')
-rwxr-xr-xwin32/contrib/setenv.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/win32/contrib/setenv.c b/win32/contrib/setenv.c
new file mode 100755
index 000000000..ffd85f872
--- /dev/null
+++ b/win32/contrib/setenv.c
@@ -0,0 +1,19 @@
+
+#include <xinesuppt.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+/* This function will leak a small amount of memory */
+void setenv(const char *name, const char *val, int _xx)
+{
+ int len = strlen(name) + strlen(val) + 2;
+ char *env = malloc(len);
+
+ if (env != NULL) {
+ strcpy(env, name);
+ strcat(env, "=");
+ strcat(env, val);
+ putenv(env);
+ }
+}