1 | /* |
2 | * Copyright (c) 2015, PHILIPPE TILLET. All rights reserved. |
3 | * |
4 | * This file is part of ISAAC. |
5 | * |
6 | * ISAAC is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2.1 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Lesser General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Lesser General Public |
17 | * License along with this library; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
19 | * MA 02110-1301 USA |
20 | */ |
21 | |
22 | #ifndef TDL_TOOLS_SYS_GETENV_HPP |
23 | #define TDL_TOOLS_SYS_GETENV_HPP |
24 | |
25 | #include <string> |
26 | #include <cstdlib> |
27 | |
28 | namespace triton |
29 | { |
30 | |
31 | namespace tools |
32 | { |
33 | |
34 | inline std::string getenv(const char * name) |
35 | { |
36 | const char * cstr = std::getenv(name); |
37 | if(!cstr) |
38 | return "" ; |
39 | std::string result(cstr); |
40 | return result; |
41 | } |
42 | |
43 | } |
44 | |
45 | } |
46 | |
47 | #endif |
48 | |