Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 1999 12:13:13 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Patryk Zadarnowski <patrykz@mycenae.ilion.eu.org>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: environment strings
Message-ID:  <19990629121313.B85121@freebie.lemis.com>
In-Reply-To: <199906290218.MAA29451@mycenae.ilion.eu.org>; from Patryk Zadarnowski on Tue, Jun 29, 1999 at 12:18:07PM %2B1000
References:  <19990629095659.B86806@freebie.lemis.com> <199906290218.MAA29451@mycenae.ilion.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, 29 June 1999 at 12:18:07 +1000, Patryk Zadarnowski wrote:
>
>>> I wanted t know where the environment strings i bsd were stored after a
>>> program execs another one.
>
> extern char **environ;
>
>> At the top of memory.  You can access them by the standard (but
>> undocumented) method:
>>
>> int main (int argc, char *argv [], char *envp [])
>>
>> envp is a pointer to the environment strings.  This is true for every
>> version of UNIX I know.
>
> This is of course correct except for the `undocumented' claim. The
> `envp' has been documented as the third argument to main() since the
> Pharaons (well, not quite ;). Apparently AT&T UNIX even has a
> (documented) five-parameter main().

This is news to me.  Can you point to the documentation?

> Besides, the `envp' argument is a recommended extension in ISO/ANSI
> C, so you can hardly say that it's undocumented.

Hmm.  I don't have the Standard here, but I've dug around and found a
couple of references to the third parameter, an "optional extension".
I think the real problem is that K&R didn't describe it: it was
introduced in the Seventh Edition, which came after K&R.

Greg
--
See complete headers for address, home page and phone numbers
finger grog@lemis.com for PGP public key


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990629121313.B85121>