diff options
author | Andy Broad <andy@broad.ology.org.uk> | 2015-08-27 09:31:34 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-09-05 11:12:45 -0400 |
commit | 6e3136a65af8652c1ee695f86642438ada8d82cb (patch) | |
tree | b87c4a7d39a08d38b7f9c61ab8dc3d63fa01ce59 | |
parent | 5ce45b7bbc7aa6b7aeb0db6c6a7faa07a30bff04 (diff) | |
download | perl-6e3136a65af8652c1ee695f86642438ada8d82cb.tar.gz |
amigaos4: use our own environ implementation
-rw-r--r-- | perl.h | 9 | ||||
-rw-r--r-- | unixish.h | 5 | ||||
-rw-r--r-- | util.c | 11 |
3 files changed, 23 insertions, 2 deletions
@@ -778,6 +778,15 @@ /* If this causes problems, set i_unistd=undef in the hint file. */ #ifdef I_UNISTD # include <unistd.h> +# if defined(__amigaos4__) +/* Under AmigaOS 4 newlib.library provides an environ. However using + * it doesn't give us enough control over inheritance of variables by + * subshells etc. so replace with custom version based on abc-shell + * code. */ +extern char **myenviron; +# undef environ +# define environ myenviron +# endif #endif /* for WCOREDUMP */ @@ -129,11 +129,12 @@ #if defined(__amigaos4__) void amigaos4_init_fork_array(); void amigaos4_dispose_fork_array(); +void amigaos4_init_environ_sema(); # define PERL_SYS_INIT_BODY(c,v) \ - MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; MALLOC_INIT; amigaos4_init_fork_array(); + MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; MALLOC_INIT; amigaos4_init_fork_array(); amigaos4_init_environ_sema(); # define PERL_SYS_TERM_BODY() \ HINTS_REFCNT_TERM; OP_CHECK_MUTEX_TERM; \ - OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; amigaos4_dispose_fork_array(); + OP_REFCNT_TERM; PERLIO_TERM; MALLOC_TERM; amigaos4_dispose_fork_array(); #endif #ifndef PERL_SYS_INIT_BODY @@ -2055,6 +2055,9 @@ void Perl_my_setenv(pTHX_ const char *nam, const char *val) { dVAR; +#if defined(__amigaos4__) + amigaos4_obtain_environ(__FUNCTION__); +#endif #ifdef USE_ITHREADS /* only parent thread can modify process environment */ if (PL_curinterp == aTHX) @@ -2096,7 +2099,11 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val) environ[i] = environ[i+1]; i++; } +#if defined(__amigaos4__) + goto my_setenv_out; +#else return; +#endif } if (!environ[i]) { /* does not exist yet */ environ = (char**)safesysrealloc(environ, (i+2) * sizeof(char*)); @@ -2157,6 +2164,10 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val) } #endif } +#if defined(__amigaos4__) +my_setenv_out: + amigaos4_release_environ(__FUNCTION__); +#endif } #else /* WIN32 || NETWARE */ |