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 g...@lemis.com for PGP public key To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-hackers" in the body of the message