summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2001-12-11 12:52:57 -0800
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-12 15:04:03 +0000
commit619685113277299f7d5ceee4658212496ca713ad (patch)
tree6928c2c491acd53268c3916548fae48968758d6d /perl.c
parentfe5a182ca3b72c3fb16ad25f60746996b5ed4338 (diff)
downloadperl-619685113277299f7d5ceee4658212496ca713ad.tar.gz
Passing in env to perl_parse did not work
Message-ID: <lrheqxniom.fsf@caliper.activestate.com> p4raw-id: //depot/perl@13660
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c40
1 files changed, 5 insertions, 35 deletions
diff --git a/perl.c b/perl.c
index e1d3d18e1c..cd82fe2ff5 100644
--- a/perl.c
+++ b/perl.c
@@ -3430,10 +3430,6 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
char *s;
SV *sv;
GV* tmpgv;
-#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
- char **dup_env_base = 0;
- int dup_env_count = 0;
-#endif
PL_toptarget = NEWSV(0,0);
sv_upgrade(PL_toptarget, SVt_PVFM);
@@ -3482,46 +3478,20 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
env = environ;
if (env != environ)
environ[0] = Nullch;
-#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
- {
- char **env_base;
- for (env_base = env; *env; env++)
- dup_env_count++;
- if ((dup_env_base = (char **)
- safesysmalloc( sizeof(char *) * (dup_env_count+1) ))) {
- char **dup_env;
- for (env = env_base, dup_env = dup_env_base;
- *env;
- env++, dup_env++) {
- /* With environ one needs to use safesysmalloc(). */
- *dup_env = safesysmalloc(strlen(*env) + 1);
- (void)strcpy(*dup_env, *env);
- }
- *dup_env = Nullch;
- env = dup_env_base;
- } /* else what? */
- }
-#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
if (env)
for (; *env; env++) {
if (!(s = strchr(*env,'=')))
continue;
- *s++ = '\0';
#if defined(MSDOS)
+ *s = '\0';
(void)strupr(*env);
+ *s = '=';
#endif
- sv = newSVpv(s--,0);
+ sv = newSVpv(s+1, 0);
(void)hv_store(hv, *env, s - *env, sv, 0);
- *s = '=';
+ if (env != environ)
+ mg_set(sv);
}
-#ifdef NEED_ENVIRON_DUP_FOR_MODIFY
- if (dup_env_base) {
- char **dup_env;
- for (dup_env = dup_env_base; *dup_env; dup_env++)
- safesysfree(*dup_env);
- safesysfree(dup_env_base);
- }
-#endif /* NEED_ENVIRON_DUP_FOR_MODIFY */
#endif /* USE_ENVIRON_ARRAY */
}
TAINT_NOT;