2 // Copyright (c) 2012 Artyom Beilis (Tonkikh)
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED
9 #define BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED
11 #include <boost/nowide/config.hpp>
12 #if !defined(BOOST_WINDOWS)
18 #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
23 /// \brief UTF-8 aware getenv. Returns 0 if the variable is not set.
25 /// This function is not thread safe or reenterable as defined by the standard library
27 BOOST_NOWIDE_DECL char* getenv(const char* key);
30 /// Same as std::system but cmd is UTF-8.
32 BOOST_NOWIDE_DECL int system(const char* cmd);
36 /// \brief Set environment variable \a key to \a value
38 /// if overwrite is not 0, that the old value is always overwritten, otherwise,
39 /// if the variable exists it remains unchanged
41 /// \a key and \a value are UTF-8 on Windows
42 /// \return zero on success, else nonzero
44 BOOST_NOWIDE_DECL int setenv(const char* key, const char* value, int overwrite);
47 /// \brief Remove environment variable \a key
49 /// \a key is UTF-8 on Windows
50 /// \return zero on success, else nonzero
52 BOOST_NOWIDE_DECL int unsetenv(const char* key);
55 /// \brief Adds or changes an environment variable, \a string must be in format KEY=VALUE
57 /// \a string MAY become part of the environment, hence changes to the value MAY change
58 /// the environment. For portability it is hence recommended NOT to change it.
59 /// \a string is UTF-8 on Windows
60 /// \return zero on success, else nonzero
62 BOOST_NOWIDE_DECL int putenv(char* string);