setenv from c
Myke Reynolds
myke at gitpyr.UUCP
Mon Sep 23 08:43:17 AEST 1985
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
More information about the Comp.lang.c
mailing list