ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FeepingCreaturism/Environment.cpp
Revision: 203
Committed: 2004-09-01T02:10:19-07:00 (20 years, 9 months ago) by Douglas Thrift
File size: 586 byte(s)
Log Message:
What now?

File Contents

# User Rev Content
1 Douglas Thrift 194 // Feeping Creaturism
2     //
3     // Douglas Thrift
4     //
5     // $Id$
6    
7     #include "Environment.hpp"
8    
9 Douglas Thrift 203 ext::String Environment::get(const ext::String& name) const
10 Douglas Thrift 194 {
11     char* value(getenv(name.c_str()));
12    
13     return value != NULL ? value : "";
14     }
15    
16 Douglas Thrift 203 int Environment::set(const ext::String& name, const ext::String& value,
17 Douglas Thrift 194 bool overwrite)
18     {
19     return setenv(name.c_str(), value.c_str(), overwrite);
20     }
21    
22 Douglas Thrift 203 int Environment::put(const ext::String& env)
23 Douglas Thrift 194 {
24     std::istringstream input(env);
25     std::string name, value;
26    
27     std::getline(input, name, '=');
28     std::getline(input, value);
29    
30     return set(name, value);
31     }
32    
33     Environment env;

Properties

Name Value
svn:eol-style native
svn:keywords Id