setenv() call?

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Mon Feb 18 19:03:36 AEST 1991


In article <1991Feb17.205749.27681 at athena.mit.edu>, jik at athena.mit.edu (Jonathan I. Kamens) writes:
> In article <JB--AP*@irie.ais.org>, jph at ais.org (Joseph Hillenburg) writes:
> |> Do any of you know of a way to implement a setenv() system call on 4.3BSD?

>   I'd say that "everyone you've talked to" is wrong.
> 
>   The 4.3reno BSD contains implementation of putenv, setenv and unsetenv. 

The question is not whether it is possible to have a function called
setenv() that does something to a copy of the environment.  The question
is whether there is a way to do what the original poster has in mind,
which he unfortunately forgot to tell us.  If Joseph Hillenburg wants a
function which will set variables in the environment of the parent shell
(which is what people are usually looking for, and what "can't do it" is
usually referring to), then the BSD functions are irrelevant, because
they don't do that.

In UNIX, getenv() and putenv() -- and setenv() and unsetenv() if you
have them -- work on a COPY of the parent's environment.  In other
operating systems, it varies.  See "logical names" in VMS documentation.
putenv() -- if you have it -- is _likely_ to affect commands executed
via system(), but not the parent CLI.

-- 
Professional programming is paranoid programming



More information about the Comp.unix.programmer mailing list