Path: utzoo!attcan!uunet!husc6!rutgers!mtunx!mtuxo!mtgzy!mtgzz!avr From: avr@mtgzz.UUCP (XMRP50000[jcm]-a.v.reed) Newsgroups: comp.unix.questions Subject: Re: putenv() Summary: use execve() Message-ID: <4138@mtgzz.UUCP> Date: 31 May 88 16:02:31 GMT References: <344@n3dmc.UUCP> Organization: AT&T, Middletown NJ Lines: 16 In article <344@n3dmc.UUCP>, johnl@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)