13 |
|
#include <vector> |
14 |
|
#include <map> |
15 |
|
#include <algorithm> |
16 |
+ |
#include <cstdlib> |
17 |
|
#include <cctype> |
18 |
|
|
18 |
– |
using namespace std; |
19 |
– |
|
19 |
|
#include <menes-ext/casts.hpp> |
20 |
|
|
21 |
+ |
using namespace std; |
22 |
+ |
|
23 |
|
inline string sgetenv(const string& name) |
24 |
|
{ |
25 |
|
char* value = getenv(name.c_str()); |
27 |
|
return value != NULL ? value : ""; |
28 |
|
} |
29 |
|
|
30 |
+ |
inline int ssetenv(const string& name, const string& value, bool write = true) |
31 |
+ |
{ |
32 |
+ |
return setenv(name.c_str(), value.c_str(), write); |
33 |
+ |
} |
34 |
+ |
|
35 |
|
inline int sputenv(const string& env) |
36 |
|
{ |
37 |
|
istringstream input(env); |
40 |
|
getline(input, name, '='); |
41 |
|
getline(input, value); |
42 |
|
|
43 |
< |
return setenv(name.c_str(), value.c_str(), true); |
43 |
> |
return ssetenv(name, value); |
44 |
|
} |
45 |
|
|
46 |
|
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |