diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2015-08-15 13:37:17 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2015-08-15 13:37:17 -0700 |
commit | 93d57bd73a885df46f45a1e771a8f9568144fd6a (patch) | |
tree | 8a08e090c232692f7cdc7b31d87f976f7efad07e /src/env.cpp | |
parent | 60798798ef37fc0dcee3edece62ca11fb2d1ced8 (diff) |
Factor function environment preparation into its own function
Diffstat (limited to 'src/env.cpp')
-rw-r--r-- | src/env.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/env.cpp b/src/env.cpp index 649e0f2a..9c6e21fb 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -1354,6 +1354,30 @@ const char * const *env_export_arr(bool recalc) return export_array.get(); } +void env_set_argv(const wchar_t * const * argv) +{ + if (*argv) + { + const wchar_t * const *arg; + wcstring sb; + + for (arg=argv; *arg; arg++) + { + if (arg != argv) + { + sb.append(ARRAY_SEP_STR); + } + sb.append(*arg); + } + + env_set(L"argv", sb.c_str(), ENV_LOCAL); + } + else + { + env_set(L"argv", 0, ENV_LOCAL); + } +} + env_vars_snapshot_t::env_vars_snapshot_t(const wchar_t * const *keys) { ASSERT_IS_MAIN_THREAD(); |