From 34d95ab0f6f686309ce09ec37889afc625f25149 Mon Sep 17 00:00:00 2001 From: das Date: Tue, 7 Aug 2007 05:04:48 +0000 Subject: * generic/tclEnv.c: improve environ handling on Mac OS X (adapted * unix/tclUnixPort.h: from Apple changes in Darwin tcl-64). --- generic/tclEnv.c | 24 +----------------------- unix/tclUnixPort.h | 14 ++++++++++---- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index a7c7c39..198ff81 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEnv.c,v 1.20.2.3 2006/10/31 22:25:08 das Exp $ + * RCS: @(#) $Id: tclEnv.c,v 1.20.2.4 2007/08/07 05:04:48 das Exp $ */ #include "tclInt.h" @@ -39,15 +39,6 @@ static int environSize = 0; /* Non-zero means that the environ array was #endif /* - * For MacOS X - */ -#if defined(__APPLE__) && defined(__DYNAMIC__) -#include -__private_extern__ char **environ; -char **environ = NULL; -#endif - -/* * Declarations for local procedures defined in this file: */ @@ -97,13 +88,6 @@ TclSetupEnv(interp) int i; /* - * For MacOS X - */ -#if defined(__APPLE__) && defined(__DYNAMIC__) - environ = *_NSGetEnviron(); -#endif - - /* * Synchronize the values in the environ array with the contents * of the Tcl "env" variable. To do this: * 1) Remove the trace that fires when the "env" var is unset. @@ -214,12 +198,6 @@ TclSetEnv(name, value) } environ = ourEnviron = newEnviron; environSize = length + 5; -#if defined(__APPLE__) && defined(__DYNAMIC__) - { - char ***e = _NSGetEnviron(); - *e = environ; - } -#endif } index = length; environ[index + 1] = NULL; diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index d98e8e4..203d319 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -19,7 +19,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixPort.h,v 1.27.2.18 2007/04/21 22:42:49 kennykb Exp $ + * RCS: @(#) $Id: tclUnixPort.h,v 1.27.2.19 2007/08/07 05:04:48 das Exp $ */ #ifndef _TCLUNIXPORT @@ -491,10 +491,16 @@ extern int errno; * Variables provided by the C library: */ -#if defined(_sgi) || defined(__sgi) || (defined(__APPLE__) && defined(__DYNAMIC__)) -# define environ _environ -#endif +#if defined(__APPLE__) && defined(__DYNAMIC__) +# include +# define environ (*_NSGetEnviron()) +# define USE_PUTENV 1 +#else +# if defined(_sgi) || defined(__sgi) +# define environ _environ +# endif extern char **environ; +#endif /* * At present (12/91) not all stdlib.h implementations declare strtod. -- cgit v0.12