2ba0a7b40f
^KT-48179
22 lines
489 B
Modula-2
22 lines
489 B
Modula-2
headers = stdlib.h
|
|
compilerOpts.mingw = -D ADD_WINDOWS_ENV_FUNCTIONS
|
|
|
|
---
|
|
|
|
#ifdef ADD_WINDOWS_ENV_FUNCTIONS
|
|
static inline int setenv(const char *name, const char *value, int overwrite)
|
|
{
|
|
int errcode = 0;
|
|
if (!overwrite) {
|
|
size_t envsize = 0;
|
|
errcode = getenv_s(&envsize, NULL, 0, name);
|
|
if(errcode || envsize) return errcode;
|
|
}
|
|
return _putenv_s(name, value);
|
|
}
|
|
static inline int unsetenv(const char *name)
|
|
{
|
|
return _putenv_s(name, "");
|
|
}
|
|
#endif
|