Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
10 | reyssat | 1 | #include "../config.h" |
2 | |||
3 | #ifndef HAVE_SETENV |
||
4 | #include <stdlib.h> |
||
5 | #include <stdio.h> |
||
6 | extern void *xmalloc(size_t n); |
||
7 | int setenv(const char *name, const char *value, int overwrite) |
||
8 | { |
||
9 | char *s; |
||
10 | if (!overwrite && getenv(name)) return 0; |
||
11 | s = xmalloc(2 + strlen(name) + strlen(value)); |
||
12 | sprintf(s, "%s=%s", name,value); |
||
13 | return putenv(s); |
||
14 | } |
||
15 | |||
16 | /* putenv("FOO=") should remove FOO from environment */ |
||
17 | void unsetenv(const char *name) { setenv(name,"",1); } |
||
18 | #endif |