src/SDL_compat.c
changeset 3581 15eea7a1fa97
parent 3518 abefdc334970
child 3585 f8816ffa210b
--- a/src/SDL_compat.c	Wed Dec 16 08:17:05 2009 +0000
+++ b/src/SDL_compat.c	Wed Dec 16 10:59:51 2009 +0000
@@ -1754,4 +1754,26 @@
     return previous;
 }
 
+
+int
+SDL_putenv(const char *_var)
+{
+    char *ptr = NULL;
+    char *var = SDL_strdup(_var);
+    if (var == NULL) {
+        return -1;  /* we don't set errno. */
+    }
+
+    ptr = strchr(var, '=');
+    if (ptr == NULL) {
+        SDL_free(var);
+        return -1;
+    }
+
+    *ptr = '\0';  /* split the string into name and value. */
+    SDL_setenv(var, ptr + 1, 1);
+    SDL_free(var);
+    return 0;
+}
+
 /* vi: set ts=4 sw=4 expandtab: */