diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-15 12:18:52 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2018-06-15 14:28:49 +0300 |
commit | b72f23ce67bc30d3bedbeabcf0b6d9c1fbf2a64f (patch) | |
tree | 5972d56a40da992ccd76e91e0ca6c05e7265c8eb /build2/b.cxx | |
parent | 75313e6fead3b82a4be2d37b341a735f7b61279b (diff) |
Use portable environment variable manipulation functions
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; } |