![]() |
|
|||
File indexing completed on 2025-09-18 08:52:49
0001 // 0002 // Copyright (c) 2012 Artyom Beilis (Tonkikh) 0003 // 0004 // Distributed under the Boost Software License, Version 1.0. 0005 // https://www.boost.org/LICENSE_1_0.txt 0006 0007 #ifndef BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED 0008 #define BOOST_NOWIDE_CSTDLIB_HPP_INCLUDED 0009 0010 #include <boost/nowide/config.hpp> 0011 #if !defined(BOOST_WINDOWS) 0012 #include <cstdlib> 0013 #endif 0014 0015 namespace boost { 0016 namespace nowide { 0017 #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) 0018 using std::getenv; 0019 using std::system; 0020 #else 0021 /// 0022 /// \brief UTF-8 aware getenv. Returns 0 if the variable is not set. 0023 /// 0024 /// The string pointed to shall not be modified by the program. 0025 /// This function is thread-safe as long as no other thread modifies the host environment. 0026 /// However subsequent calls to this function might overwrite the string pointed to. 0027 /// 0028 /// Warning: The returned pointer might only be valid for as long as the calling thread is alive. 0029 /// So avoid passing it across thread boundaries. 0030 /// 0031 BOOST_NOWIDE_DECL char* getenv(const char* key); 0032 0033 /// 0034 /// Same as std::system but cmd is UTF-8. 0035 /// 0036 BOOST_NOWIDE_DECL int system(const char* cmd); 0037 0038 #endif 0039 /// 0040 /// \brief Set environment variable \a key to \a value 0041 /// 0042 /// if overwrite is not 0, that the old value is always overwritten, otherwise, 0043 /// if the variable exists it remains unchanged 0044 /// 0045 /// \a key and \a value are UTF-8 on Windows 0046 /// \return zero on success, else nonzero 0047 /// 0048 BOOST_NOWIDE_DECL int setenv(const char* key, const char* value, int overwrite); 0049 0050 /// 0051 /// \brief Remove environment variable \a key 0052 /// 0053 /// \a key is UTF-8 on Windows 0054 /// \return zero on success, else nonzero 0055 /// 0056 BOOST_NOWIDE_DECL int unsetenv(const char* key); 0057 0058 /// 0059 /// \brief Adds or changes an environment variable, \a string must be in format KEY=VALUE 0060 /// 0061 /// \a string MAY become part of the environment, hence changes to the value MAY change 0062 /// the environment. For portability it is hence recommended NOT to change it. 0063 /// \a string is UTF-8 on Windows 0064 /// \return zero on success, else nonzero 0065 /// 0066 BOOST_NOWIDE_DECL int putenv(char* string); 0067 0068 } // namespace nowide 0069 } // namespace boost 0070 0071 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |