This is the mail archive of the
mailing list for the glibc project.
Re: environ and -D_GNU_SOURCE
I'm not sure about this idea, however if this environ discussion is primarily for
an application or system which needs to be developed or modified and Perl is
available, then a simple embedded Perl call to extract the values or definitions
of the %ENV hash might be equally good, entirely (or nearly entirely) portable
(and could be done with pragmas), etcetera, the only catch being that Perl must
Without examining the content of C's **environ and Perl's %ENV, I don't know if
using %ENV would provide the data the program in question needs, that is, if
there's a particular program at the base of this discussion thread. However,
this might be a useful way to work similar problems in the future.
There's a mechanism for embedding Perl code in C programs and %ENV is supposed to
contain the definitions of the effective or real user's shell environment.
Perhaps it'ld be better to stick with C, for this, but I figured adding this
comment should not hurt; it might also help to generate educational feedback.
Andreas Jaeger wrote:
> >>>>> Kaz Kylheku writes:
> Kaz> On 17 May 2000, Andreas Jaeger wrote:
> >> environ is not part of any standard AFAIK - and therefore you need
> >> _GNU_SOURCE. If it would be, you would get it via one of the other
> Kaz> The static object
> Kaz> extern char **environ;
> Kaz> is documented in The Single Unix Specification. So its declaration can be
> Kaz> probably be available by the less inclusive _XOPEN_SOURCE .
> Kaz> See:
> Kaz> http://www.unix-systems.org/onlinepubs/007908799/xsh/environ.html
> I checked again. The variable is available but not visible - the user
> has to declare it.
> This isn't really clear from the Single Unix Specification (it doesn't
> mention a header!) but clarified in the rationale of the latest Austin
> I'll take no further action on this.
> Andreas Jaeger
> SuSE Labs firstname.lastname@example.org
> private email@example.com