ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FeepingCreaturism/Environment.cpp
Revision: 243
Committed: 2004-09-11T21:27:10-07:00 (20 years, 9 months ago) by Douglas Thrift
File size: 614 byte(s)
Log Message:
Meep!

File Contents

# Content
1 // Feeping Creaturism
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 #include "Environment.hpp"
8
9 ext::String Environment::get(const ext::String& name) const
10 {
11 char* value(::getenv(name.NullTerminate()));
12
13 return value != NULL ? value : "";
14 }
15
16 int Environment::set(const ext::String& name, const ext::String& value,
17 bool overwrite)
18 {
19 return ::setenv(name.NullTerminate(), value.NullTerminate(), overwrite);
20 }
21
22 int Environment::put(const ext::String& env)
23 {
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