diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-08-30 22:58:52 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-08-30 23:00:35 +0300 |
commit | 631c76d7613458dbef208ca056e194e94a5becf3 (patch) | |
tree | 60f9b7b511a2d857e4929d1ed4861a0280361c14 /build2/functions-builtin.cxx | |
parent | 32df5529f791760161a027a1a7408bc92976a3cd (diff) |
Make $getenv() to return untyped value
Diffstat (limited to 'build2/functions-builtin.cxx')
-rw-r--r-- | build2/functions-builtin.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/build2/functions-builtin.cxx b/build2/functions-builtin.cxx index d6d9501..03f3592 100644 --- a/build2/functions-builtin.cxx +++ b/build2/functions-builtin.cxx @@ -11,13 +11,20 @@ using namespace std; namespace build2 { - // Return NULL value if an environment variable is not set. + // Return NULL value if an environment variable is not set, untyped value + // otherwise. // static inline value getenv (const string& name) { const char* v (::getenv (name.c_str ())); - return v != nullptr ? value (v) : value (); + + if (v == nullptr) + return value (); + + names r; + r.emplace_back (to_name (v)); + return value (move (r)); } void |