// Copyright (C) 2010, Guy Barrand. All rights reserved.
// See the file tools.license for terms.

#ifndef tools_get_env
#define tools_get_env

#include <cstdlib>

namespace tools {

inline bool is_env(const std::string& a_string){
  const char* env = ::getenv(a_string.c_str());
  return (env?true:false);
}

inline bool get_env(const std::string& a_string,std::string& a_value){
  const char* env = ::getenv(a_string.c_str());
  if(env) {
    a_value = std::string(env?env:"");
    return true;
  } else {
    a_value.clear();
    return false;
  }
}

}

#endif
