diff options
Diffstat (limited to 'build2/b.cxx')
-rw-r--r-- | build2/b.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index de985e8..cd738f2 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -8,8 +8,6 @@ # include <libbutl/win32-utility.hxx> #endif -#include <stdlib.h> // getenv() _putenv()(_WIN32) - #ifdef __GLIBCXX__ # include <locale> #endif @@ -144,15 +142,15 @@ main (int argc, char* argv[]) // #ifdef _WIN32 { - string mp ("PATH="); - if (const char* p = getenv ("PATH")) + string mp; + if (optional<string> p = getenv ("PATH")) { - mp += p; + mp = move (*p); mp += ';'; } mp += "/bin"; - _putenv (mp.c_str ()); + setenv ("PATH", mp); } #endif @@ -465,11 +463,11 @@ main (int argc, char* argv[]) // if (verb >= 5) { - const char* p (getenv ("PATH")); + optional<string> p (getenv ("PATH")); trace << "work: " << work; trace << "home: " << home; - trace << "path: " << (p != nullptr ? p : "<NULL>"); + trace << "path: " << (p ? *p : "<NULL>"); trace << "jobs: " << jobs; } |