diff --git a/appl/login/env.c b/appl/login/env.c index 6e9cfb911..6e223e34c 100644 --- a/appl/login/env.c +++ b/appl/login/env.c @@ -69,6 +69,11 @@ add_env(const char *var, const char *value) extend_env(str); } +#if !HAVE_DECL_ENVIRON +extern char **environ; +#endif + + void copy_env(void) { diff --git a/appl/su/su.c b/appl/su/su.c index 54bc307f9..552353380 100644 --- a/appl/su/su.c +++ b/appl/su/su.c @@ -64,6 +64,10 @@ RCSID("$Id$"); #include "supaths.h" +#if !HAVE_DECL_ENVIRON +extern char **environ; +#endif + int kerberos_flag = 1; int csh_f_flag; int full_login; @@ -506,7 +510,7 @@ main(int argc, char **argv) if (ok == 5) krb5_start_session(); #endif - execv(shell, args); + execve(shell, args, environ); } exit(1); diff --git a/appl/telnet/telnet/commands.c b/appl/telnet/telnet/commands.c index 787d168cb..ac6b54fb0 100644 --- a/appl/telnet/telnet/commands.c +++ b/appl/telnet/telnet/commands.c @@ -1553,8 +1553,8 @@ env_find(unsigned char *var) return(NULL); } -#ifdef IRIX4 -#define environ _environ +#if !HAVE_DECL_ENVIRON +extern char **environ; #endif void diff --git a/appl/telnet/telnetd/sys_term.c b/appl/telnet/telnetd/sys_term.c index 6a35a7794..2a654b113 100644 --- a/appl/telnet/telnetd/sys_term.c +++ b/appl/telnet/telnetd/sys_term.c @@ -1186,7 +1186,9 @@ startslave(const char *host, const char *utmp_host, } char *envinit[3]; +#if !HAVE_DECL_ENVIRON extern char **environ; +#endif void init_env(void) diff --git a/lib/roken/environment.c b/lib/roken/environment.c index 94ceedf9f..35f3c8b1b 100644 --- a/lib/roken/environment.c +++ b/lib/roken/environment.c @@ -63,7 +63,7 @@ find_var(char **env, char *assignment, size_t len) */ static int -rk_read_env_file(FILE *F, char ***env, int *assigned) +read_env_file(FILE *F, char ***env, int *assigned) { int idx = 0; int i; @@ -139,7 +139,7 @@ read_environment(const char *file, char ***env) if ((F = fopen(file, "r")) == NULL) return 0; - rk_read_env_file(F, env, &assigned); + read_env_file(F, env, &assigned); fclose(F); return assigned; } diff --git a/lib/roken/putenv.c b/lib/roken/putenv.c index ea234694a..eec2377f6 100644 --- a/lib/roken/putenv.c +++ b/lib/roken/putenv.c @@ -38,7 +38,9 @@ RCSID("$Id$"); #include +#if !HAVE_DECL_ENVIRON extern char **environ; +#endif /* * putenv -- diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 5231cbf65..d71bee7b4 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -444,10 +444,6 @@ extern int optind; extern int opterr; #endif -#if !HAVE_DECL_ENVIRON -extern char **environ; -#endif - #ifndef HAVE_GETIPNODEBYNAME struct hostent * ROKEN_LIB_FUNCTION getipnodebyname (const char *, int, int, int *); diff --git a/lib/roken/simple_exec.c b/lib/roken/simple_exec.c index c99a99373..7060cb8d3 100644 --- a/lib/roken/simple_exec.c +++ b/lib/roken/simple_exec.c @@ -51,6 +51,10 @@ RCSID("$Id$"); #include "roken.h" +#if !HAVE_DECL_ENVIRON +extern char **environ; +#endif + #define EX_NOEXEC 126 #define EX_NOTFOUND 127 diff --git a/lib/roken/unsetenv.c b/lib/roken/unsetenv.c index d7a09a50b..01dd78936 100644 --- a/lib/roken/unsetenv.c +++ b/lib/roken/unsetenv.c @@ -41,7 +41,9 @@ RCSID("$Id$"); #include "roken.h" +#if !HAVE_DECL_ENVIRON extern char **environ; +#endif /* * unsetenv --