This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate Sarathy's Win32 $ENV{'PATH'}/system fixes (11399, 11400)
authorNick Ing-Simmons <nik@tiuk.ti.com>
Wed, 18 Jul 2001 06:50:33 +0000 (06:50 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Wed, 18 Jul 2001 06:50:33 +0000 (06:50 +0000)
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..)

win32/perlhost.h
win32/win32.c

index 815be84..45ce0dd 100644 (file)
@@ -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;
 }
 
index 5f4a177..033ebb9 100644 (file)
@@ -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;