ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FeepingCreaturism/Environment.cpp
Revision: 236
Committed: 2004-09-10T16:15:19-07:00 (20 years, 9 months ago) by Douglas Thrift
File size: 610 byte(s)
Log Message:
Get rid of deprecated stuff.

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 Douglas Thrift 236 char* value(getenv(name.NullTerminate()));
12 Douglas Thrift 194
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 Douglas Thrift 236 return setenv(name.NullTerminate(), value.NullTerminate(), overwrite);
20 Douglas Thrift 194 }
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