The environment of the parent

Israel Pinkas pinkas at mipos3.UUCP
Thu Nov 20 02:58:41 AEST 1986


A co-worker of mine has asked me a question that I could not resolve and am
now asking the net to help me with.

He has a program which look in the environment (using getenv()) for certain
strings.  If the strings are not present, he asks the user for values.
What he would like to do is set the value of these strings so that
subsequent runs of the program will be able to find the values.  That is,
he would like to place the typed-in values in the parents environment
space.  (This program is being ported from VMS, which allows such things to
be done.)

Calls to putenv() are not the solution as programs only receive a copy of
the parent's (read shell) environment and are only able to modify their own
environment.  This does allow you to spawn a shell, which will have any
values placed in the environment, but this is not what we want.

Any pointers as to how to get at, and set, the parent's environment would
be helpful.

Note: We are running Ultrix v1.2 on a variety of Vaxen.  Info about any
Un*x-like OS would be helpful.  If there is enough response, I will
summarize on comp.unix.questions.

-Israel

-- 
----------------------------------------------------------------------
UUCP:	{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!pinkas
ARPA:	pinkas%mipos3.intel.com at relay.cs.net
CSNET:	pinkas%mipos3.intel.com



More information about the Comp.unix.questions mailing list