summaryrefslogtreecommitdiff
path: root/src/tools.cc
blob: f4e68355d5b771ec331199b0603ca669be4ef13e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 *  @file  tools.cc
 *  @brief  Implementation of miscellaneous tools.
 *  @author Andreas Aardal Hanssen
 *  @date 2002-2005
 */

#include "tools.h"

#include <stdlib.h>

void Binc::Tools::setenv(const std::string &key, const std::string &value)
{
  ::setenv(key.c_str(), value.c_str(), 1);
}

std::optional<std::string> Binc::Tools::getenv(const std::string &key)
{
  const char *c = ::getenv(key.c_str());
  return c ? std::make_optional(c) : std::nullopt;
}