Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gitpyr.UUCP
Path: utzoo!watmath!clyde!bonnie!akgua!gatech!gitpyr!myke
From: myke@gitpyr.UUCP (Myke Reynolds)
Newsgroups: net.lang.c
Subject: Re: setenv from c
Message-ID: <814@gitpyr.UUCP>
Date: Sun, 22-Sep-85 18:43:17 EDT
Article-I.D.: gitpyr.814
Posted: Sun Sep 22 18:43:17 1985
Date-Received: Mon, 23-Sep-85 02:57:27 EDT
References: <2936@ncsu.UUCP>
Reply-To: myke@gitpyr.UUCP (Myke Reynolds)
Distribution: net
Organization: School of ICS, Georgia Tech
Lines: 27
Keywords: envp
Summary: how about a child's env

Well, the following program will pass a parent's environment variables to
a child. It nukes the first env var and replaces it with a new one.
What you want to do is change the internal variables of a parent process.
It will only do that if it wants to let you, there is no inherent way of
doing it. Note that setenv and set are shell commands, not executable
files..

---------------------------------------------------------------------------------
char	*newvar = "newvar = (here I am !)";

main(argc, argv, envp)
char	**argv, **envp;
{
	envp[0] = newvar;

	execle("/bin/csh", "csh", 0, envp);
}
-- 
Myke Reynolds
Office of Telecommunications and Networking
Georgia Insitute of Technology, Atlanta Georgia, 30332
...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!myke


"Too bad all the people that know how to run this country are busy cutting
hair and driving taxi cabs."
		-George Burns