diff options
author | Gurusamy Sarathy <gsar@engin.umich.edu> | 1997-06-22 17:34:00 +1200 |
---|---|---|
committer | Tim Bunce <Tim.Bunce@ig.co.uk> | 1997-08-07 00:00:00 +1200 |
commit | 0551aaa8f66eb12adb34e496ae8608b54066193c (patch) | |
tree | 14a80d692a941788a66bc4c376f9fa97fec08c1d /win32/win32.c | |
parent | 6890e559d7ce8a57fe2b6b18ef51d300ce98843f (diff) | |
download | perl-0551aaa8f66eb12adb34e496ae8608b54066193c.tar.gz |
getenv() after my_setenv() gets old entry on Win32
Perl uses the environment to communicate the -d:DProf
switch to itself.
Since the win32 code sets the operating system's env block
directly when my_setenv() is called, calls to the RTL's
getenv() won't see the changed environment, so the -d:Foo
option is not honored.
The attached patch fixes the problem by supplying our own
getenv() equivalent.
p5p-msgid: 199706231700.NAA23400@aatma.engin.umich.edu
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 3d226ce998..055eaf9915 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -777,6 +777,28 @@ win32_stat(const char *path, struct stat *buffer) return stat(p, buffer); } +#ifndef USE_WIN32_RTL_ENV + +DllExport char * +win32_getenv(const char *name) +{ + static char *curitem = Nullch; + static DWORD curlen = 512; + DWORD needlen; + if (!curitem) + New(1305,curitem,curlen,char); + if (!(needlen = GetEnvironmentVariable(name,curitem,curlen))) + return Nullch; + while (needlen > curlen) { + Renew(curitem,needlen,char); + curlen = needlen; + needlen = GetEnvironmentVariable(name,curitem,curlen); + } + return curitem; +} + +#endif + #undef times int mytimes(struct tms *timebuf) |