Line |
Branch |
Exec |
Source |
1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
#include <stdlib.h> |
8 |
|
|
#include "phoenix_env.h" |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
///Get the value of the given environment variable |
12 |
|
|
/** @param varName : name of the environment variable to be used |
13 |
|
|
* @return value of the variable, or empty string of the variable does not exist |
14 |
|
|
*/ |
15 |
|
4 |
PString phoenix_getenv(const PString & varName){ |
16 |
|
4 |
return phoenix_charToString(getenv(varName.c_str())); |
17 |
|
|
} |
18 |
|
|
|
19 |
|
|
///Set a environment variable |
20 |
|
|
/** @param name : name of the variable to be created |
21 |
|
|
* @param value : value of the variable to be created |
22 |
|
|
* @param overwrite : true to overwrite an existing variable, false to not to |
23 |
|
|
* @return true on success, false otherwise |
24 |
|
|
*/ |
25 |
|
1 |
bool phoenix_setenv(const PString & name, const PString & value, bool overwrite){ |
26 |
|
1 |
return setenv(name.c_str(), value.c_str(), overwrite) == 0; |
27 |
|
|
} |
28 |
|
|
|
29 |
|
|
///Unset a environment variable |
30 |
|
|
/** @param name : name of the variable to be unset |
31 |
|
|
* @return true on success, false otherwise |
32 |
|
|
*/ |
33 |
|
1 |
bool phoenix_unsetenv(const PString & name){ |
34 |
|
1 |
return unsetenv(name.c_str()) == 0; |
35 |
|
|
} |
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|