windows: Provide a setenv() wrapper

This commit is contained in:
Martin Willi
2014-06-04 15:52:59 +02:00
parent 7458952575
commit fb81820796
+12
View File
@@ -143,6 +143,18 @@ static inline struct tm *localtime_r(const time_t *timep, struct tm *result)
return ret;
}
/**
* setenv(3) from <stdlib.h>, overwrite flag is ignored
*/
static inline int setenv(const char *name, const char *value, int overwrite)
{
if (SetEnvironmentVariableA(name, value) == 0)
{ /* failed */
return -1;
}
return 0;
}
/**
* dlerror(3) from <dlfcn.h>, printing error to an alloca() buffer
*/