Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is environ?



Probably not in stdlib.h to discourage the use of the extern.
The "normal" way to get the environment is through the third argument to
main. The following program builds on darwin and shows that the extern is
indeed there, and the third main arg is indeed the same value.

#include <stdio.h>
int main(int argc, char **argv, char **envp)
{
extern char **environ;
printf("%lX %lX\n", environ, envp);
}

--
Jerry Pendergraft email@hidden
Endocardial Solutions voice: 651-523-6935
1350 Energy Lane, Suite 110 fax: 651-644-7897
St Paul, MN 55108-5254 mobile: 651-491-0163

On Tue, 10 Feb 2004, Bill Hayden wrote:

> I am porting a program from Linux to Darwin which uses the "environ"
> variable located in /usr/include/unistd.h (in Linux, anyways). There is
> no such variable in Darwin's unistd.h or anywhere else that I can find.
> Am I not looking hard enough, or is this not available in Darwin for
> some reason?
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Where is environ? (From: Bill Hayden <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.