summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-12 11:49:25 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-12 11:49:25 +0000
commitac5c734f32ccd9787762253192de0d559609abae (patch)
tree9a652b97ea5faa3c9379b58275b5a101e2076b90 /util.c
parenta2093a06980c0ef77ac4631e8b8f383be904f06a (diff)
downloadperl-ac5c734f32ccd9787762253192de0d559609abae.tar.gz
support win32_putenv()
p4raw-id: //depot/perl@2898
Diffstat (limited to 'util.c')
-rw-r--r--util.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/util.c b/util.c
index 8dd7d00931..db727f76f5 100644
--- a/util.c
+++ b/util.c
@@ -1607,21 +1607,16 @@ my_setenv(char *nam,char *val)
#else /* !USE_WIN32_RTL_ENV */
- /* The sane way to deal with the environment.
- * Has these advantages over putenv() & co.:
- * * enables us to store a truly empty value in the
- * environment (like in UNIX).
- * * we don't have to deal with RTL globals, bugs and leaks.
- * * Much faster.
- * Why you may want to enable USE_WIN32_RTL_ENV:
- * * environ[] and RTL functions will not reflect changes,
- * which might be an issue if extensions want to access
- * the env. via RTL. This cuts both ways, since RTL will
- * not see changes made by extensions that call the Win32
- * functions directly, either.
- * GSAR 97-06-07
- */
- SetEnvironmentVariable(nam,val);
+ register char *envstr;
+ STRLEN len = strlen(nam) + 3;
+ if (!val) {
+ val = "";
+ }
+ len += strlen(val);
+ New(904, envstr, len, char);
+ (void)sprintf(envstr,"%s=%s",nam,val);
+ (void)PerlEnv_putenv(envstr);
+ Safefree(envstr);
#endif
}