+
+bool unsetEnv(string const & name)
+{
+#if defined(HAVE_UNSETENV)
+ // FIXME: does it leak?
+ return ::unsetenv(name.c_str()) == 0;
+#elif defined(HAVE_PUTENV)
+ // This is OK with MSVC and MinGW at least.
+ // The argument of putenv() does not need to be a static variable in this
+ // case, since the variable is removed from the environment.
+ return ::putenv(const_cast<char*>((name + "=").c_str())) == 0;
+#else
+#error No environment-unsetting function has been defined.
+#endif
+}
+
+