[comp.sys.amiga.tech] putenv/getenv problem

brenner@sun1.ruf.uni-freiburg.de (Martin Brenner) (11/27/89)

gregg@cbnewsc.ATT.COM (gregg.g.wonderly) writes:

>From article <13920014@hpfelg.HP.COM>, by koren@hpfelg.HP.COM (Steve Koren):
>>>               However, a bug  in  either  the  compiler  or  OS  is  still
>>>               preventing  'getenv'  from  working   correctly.    I   have
>> 
>> One thing I forgot to mention; even though Ash's getenv has problems,
>> (since I can't get the Lattice call to work)...

>The routine works fine for me under 5.02.  The documentation is just not
>clear.  E.g. for the ENVariable $HOME, create the file, env:home, and
>put the string value for the variable in that file as a single line.

>I put the string "usr:gregg" in mine...

Yes, its not working as described. The following works correctly:

main()	{
	char *xy;
	putenv("test=xy\n"); /* note the \n ! */
	xy = getenv("test");
	printf("test: %s\n",xy);
	}

BTW: Anybody has an idea how to implement private environment variables?
I want to system() another program that inherits stdin and stdout and also
uses the same environment has the calling program. Hints welcome!

Greetinx,
-Martin
-- 
M a r t i n   B r e n n e r        Uni Ulm, Abt. Exp. Physik   
X.400: <G=martin;S=brenner;OU=ruf;P=uni-freiburg;A=dbp;C=de>
Sub: martin@deepth.UUCP            Bitnet: brennerm@dulruu51