src/SDL_compat.c
changeset 3581 15eea7a1fa97
parent 3518 abefdc334970
child 3585 f8816ffa210b
     1.1 --- a/src/SDL_compat.c	Wed Dec 16 08:17:05 2009 +0000
     1.2 +++ b/src/SDL_compat.c	Wed Dec 16 10:59:51 2009 +0000
     1.3 @@ -1754,4 +1754,26 @@
     1.4      return previous;
     1.5  }
     1.6  
     1.7 +
     1.8 +int
     1.9 +SDL_putenv(const char *_var)
    1.10 +{
    1.11 +    char *ptr = NULL;
    1.12 +    char *var = SDL_strdup(_var);
    1.13 +    if (var == NULL) {
    1.14 +        return -1;  /* we don't set errno. */
    1.15 +    }
    1.16 +
    1.17 +    ptr = strchr(var, '=');
    1.18 +    if (ptr == NULL) {
    1.19 +        SDL_free(var);
    1.20 +        return -1;
    1.21 +    }
    1.22 +
    1.23 +    *ptr = '\0';  /* split the string into name and value. */
    1.24 +    SDL_setenv(var, ptr + 1, 1);
    1.25 +    SDL_free(var);
    1.26 +    return 0;
    1.27 +}
    1.28 +
    1.29  /* vi: set ts=4 sw=4 expandtab: */