mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
environment.cpp
Go to the documentation of this file.
1 /** \file environment.cpp
2  * \author Jared R. Males
3  * \brief Utilities for working with the environment
4  * \ingroup utils_files
5  */
6 
7 //***********************************************************************//
8 // Copyright 2020 Jared R. Males (jaredmales@gmail.com)
9 //
10 // This file is part of mxlib.
11 //
12 // mxlib is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // mxlib is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with mxlib. If not, see <http://www.gnu.org/licenses/>.
24 //***********************************************************************//
25 
26 #include "sys/environment.hpp"
27 
28 namespace mx
29 {
30 namespace sys
31 {
32 
33 std::string getEnv(const std::string & estr )
34 {
35  char * e = getenv(estr.c_str());
36 
37  if(e) return std::string(e);
38  else return std::string("");
39 }
40 
41 }
42 }
43 
Utilities for working with the environment.
std::string getEnv(const std::string &estr)
Return the value of an environment variable.
Definition: environment.cpp:33
The mxlib c++ namespace.
Definition: mxError.hpp:107