From: Nick Ing-Simmons Date: Wed, 18 Jul 2001 06:50:33 +0000 (+0000) Subject: Integrate Sarathy's Win32 $ENV{'PATH'}/system fixes (11399, 11400) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2fb9ab56c575e2a910e23a92a6a02d3d7fd09fbb;p=p5sagit%2Fp5-mst-13.2.git Integrate Sarathy's Win32 $ENV{'PATH'}/system fixes (11399, 11400) from perl5.6* p4raw-id: //depot/perl@11405 p4raw-integrated: from //depot/maint-5.6/perl@11404 'merge in' win32/win32.c (@8917..) p4raw-integrated: from //depot/maint-5.6/perl@11400 'merge in' win32/perlhost.h (@11399..) --- diff --git a/win32/perlhost.h b/win32/perlhost.h index 815be84..45ce0dd 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -2315,9 +2315,10 @@ CPerlHost::Reset(void) void CPerlHost::Clearenv(void) { + dTHXo; char ch; LPSTR lpPtr, lpStr, lpEnvPtr; - if(m_lppEnvList != NULL) { + if (m_lppEnvList != NULL) { /* set every entry to an empty string */ for(DWORD index = 0; index < m_dwEnvCount; ++index) { char* ptr = strchr(m_lppEnvList[index], '='); @@ -2340,6 +2341,8 @@ CPerlHost::Clearenv(void) ch = *++lpPtr; *lpPtr = 0; Add(lpStr); + if (!w32_pseudo_id) + (void)win32_putenv(lpStr); *lpPtr = ch; } lpStr += strlen(lpStr) + 1; @@ -2352,22 +2355,23 @@ CPerlHost::Clearenv(void) char* CPerlHost::Getenv(const char *varname) { - char* pEnv = Find(varname); - if(pEnv == NULL) { - pEnv = win32_getenv(varname); - } - else { - if(!*pEnv) - pEnv = 0; + dTHXo; + if (w32_pseudo_id) { + char *pEnv = Find(varname); + if (pEnv && !*pEnv) + return pEnv; } - - return pEnv; + return win32_getenv(varname); } int CPerlHost::Putenv(const char *envstring) { + dTHXo; Add(envstring); + if (!w32_pseudo_id) + return win32_putenv(envstring); + return 0; } diff --git a/win32/win32.c b/win32/win32.c index 5f4a177..033ebb9 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -518,7 +518,7 @@ get_shell(void) */ const char* defaultshell = (IsWinNT() ? "cmd.exe /x/c" : "command.com /c"); - const char *usershell = getenv("PERL5SHELL"); + const char *usershell = PerlEnv_getenv("PERL5SHELL"); w32_perlshell_items = tokenize(usershell ? usershell : defaultshell, &w32_perlshell_tokens, &w32_perlshell_vec); @@ -3096,7 +3096,7 @@ qualified_path(const char *cmd) } /* look in PATH */ - pathstr = win32_getenv("PATH"); + pathstr = PerlEnv_getenv("PATH"); New(0, fullcmd, MAX_PATH+1, char); curfullcmd = fullcmd;