From f44fedd3e9e249d1587b12b01e50725089557c36 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Fri, 17 Mar 2006 10:58:37 -0500 Subject: ENH: Add access for all environment variables --- Source/cmSystemTools.cxx | 13 +++++++++++++ Source/cmSystemTools.h | 1 + 2 files changed, 14 insertions(+) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e32fc53..b140e31 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -56,6 +56,8 @@ # pragma set woff 1375 /* base class destructor not virtual */ #endif +extern char** environ; // For GetEnvironmentVariables + bool cmSystemTools::s_RunCommandHideConsole = false; bool cmSystemTools::s_DisableRunCommandOutput = false; bool cmSystemTools::s_ErrorOccured = false; @@ -1278,6 +1280,17 @@ bool cmSystemTools::PutEnv(const char* value) return ret == 0; } +std::vector cmSystemTools::GetEnvironmentVariables() +{ + std::vector env; + int cc; + for ( cc = 0; environ[cc]; ++ cc ) + { + env.push_back(environ[cc]); + } + return env; +} + void cmSystemTools::EnableVSConsoleOutput() { // Visual Studio 8 2005 (devenv.exe or VCExpress.exe) will not diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index fb40e54..c4cb4c2 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -294,6 +294,7 @@ public: /** put a string into the environment of the form var=value */ static bool PutEnv(const char* value); + static std::vector GetEnvironmentVariables(); /** Setup the environment to enable VS 8 IDE output. */ static void EnableVSConsoleOutput(); -- cgit v0.12