Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
tools.cc
Go to the documentation of this file.
1
7#include <errno.h>
8#include <cstring>
9
10#include "tools.h"
11
12using namespace ::std;
13using namespace Binc;
14
15//------------------------------------------------------------------------
16Tools::Tools(void)
17{
18}
19
20//------------------------------------------------------------------------
22{
23 static Tools tools;
24 return tools;
25}
26
27//------------------------------------------------------------------------
28void Tools::setenv(const string &key, const string &value) const
29{
30 char *c = strdup((key + "=" + value).c_str());
31 putenv(c);
32}
33
34//------------------------------------------------------------------------
35string Tools::getenv(const string &key) const
36{
37 static const string NIL = "";
38
39 const char *c = ::getenv((char *)key.c_str());
40 if (c == 0)
41 return NIL;
42 else
43 return string(c);
44}
std::string getenv(const std::string &key) const
Definition: tools.cc:35
void setenv(const std::string &key, const std::string &value) const
Definition: tools.cc:28
static Tools & getInstance(void)
Definition: tools.cc:21
Definition: bincimapd.cc:9
Declaration of miscellaneous tools.