From 631c76d7613458dbef208ca056e194e94a5becf3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 30 Aug 2017 22:58:52 +0300 Subject: Make $getenv() to return untyped value --- build2/functions-builtin.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'build2/functions-builtin.cxx') 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 -- cgit v1.1