help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] How to access environment variables ?


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] How to access environment variables ?
Date: Tue, 10 Feb 2009 16:19:54 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

> That would work with GNU C library since it is defined as follows:
> 
> /* NULL-terminated array of "NAME=VALUE" environment variables.  */
> extern char **__environ;
> #ifdef __USE_GNU
> extern char **environ;
> #endif
> 
> I'm not sure how it is defined on other Unix systems.  On Solaris 9 it
> doesn't exist in /usr/include/unistd.h:
> 
> Solaris-9% grep environ /usr/include/unistd.h
> /* large file compilation environment setup */
> /* In the LP64 compilation environment, the APIs are already large file */

environ is found more or less everywhere:

0) in most systems it is in unistd.h

1) in some systems it is in stdlib.h

2) of all others, Apple systems do not have it but you can use

   #include <crt_externs.h>
   #define environ (*_NSGetEnviron ())

3) otherwise you can define it as

   extern char **environ;

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]