MSVC: Provide implementations of [un]setenv()
authorAdrian Perez de Castro <aperez@igalia.com>
Mon, 5 Aug 2019 12:53:04 +0000 (15:53 +0300)
committerRan Benita <ran234@gmail.com>
Sat, 28 Dec 2019 14:12:15 +0000 (16:12 +0200)
Reference:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/putenv-s-wputenv-s

test/test.h

index 297c062..031806f 100644 (file)
@@ -95,3 +95,8 @@ test_disable_stdin_echo(void);
 
 void
 test_enable_stdin_echo(void);
+
+#ifdef _MSC_VER
+#define setenv(varname, value, overwrite) _putenv_s((varname), (value))
+#define unsetenv(varname) _putenv_s(varname, "")
+#endif