+/** Remove the variable @c name from the environment.
+ * @returns true if the variable was unset successfully.
+ */
+bool unsetEnv(std::string const & name);
+
+
+/** Utility class to change temporarily an environment variable. The
+ * variable is reset to its original state when the dummy EnvChanger
+ * variable is deleted.
+ */
+class EnvChanger {
+public:
+ ///
+ EnvChanger(std::string const & name, std::string const & value)
+ : name_(name), set_(hasEnv(name)), value_(getEnv(name))
+ {
+ setEnv(name, value);
+ }
+ ///
+ ~EnvChanger()
+ {
+ if (set_)
+ setEnv(name_, value_);
+ else
+ unsetEnv(name_);
+ }
+
+private:
+ /// the name of the variable
+ std::string name_;
+ /// was the variable set?
+ bool set_;
+ ///
+ std::string value_;
+};
+