putenv()

XMRP50000[jcm]-a.v.reed avr at mtgzz.UUCP
Wed Jun 1 02:02:31 AEST 1988


In article <344 at n3dmc.UUCP>, johnl at n3dmc.UUCP (John Limpert) writes:
> 
> I need to write a putenv() function for my SVR2 system.  I have
> tried to add a string to the environment but it doesn't survive
> an exec.  What is the correct method of making environment changes?

Use execve(), not execv(). After setting up the environment the way
you want it, call

	int exerror;
	exerror = execve (path, argv, envp);

where envp is an array of pointers to null-terminated strings
containing your environment. Read the manual page for details.

					Adam Reed (mtgzz!avr)



More information about the Comp.unix.questions mailing list