Hmm... can you think of any other ways?

I'm trying to run a script, not a C program.  Also, I don't know about
Unix but under DOS putenv() doesn't affect the parent program that called
the C program (it affects only itself and the children.)

-Mark

On Thu, 27 Dec 2001, Henry House wrote:

> On Thu, Dec 27, 2001 at 11:12:35PM -0800, Mark K. Kim wrote:
> > Keywords: bash, script, environment variables
> >
> > I'm doing some cross-compilation work so I need to flip environment
> > variables on/off in a heartbeat.  I tried to write a script, but scripts
> > run on sub-processes so the changes do not take effect on the parent
> > process.  Is there a way, without having to type `source script` or `.
> > script`, to make environment variables changes take place on the running
> > process?
>
> Would putenv(3) work? To quote the manual:
>
> NAME
>                putenv - change or add an environment variable
>
> SYNOPSIS
>                #include <stdlib.h>
>
>                int putenv(char *string);
>
> DESCRIPTION
>                The  putenv()  function  adds  or  changes the value of environment 
>variables.  The
>                argument string is of the form name=value.  If name does not already 
>exist  in  the
>                environment, then string is added to the environment.  If name does 
>exist, then the
>                value of name in the environment is changed to value.  The  string  
>pointed  to  by
>                string becomes part of the environment, so altering the string 
>changes the environ�
>                ment.
>
> --
> Henry House
> The attached file is a digital signature. See <http://romana.hajhouse.org/pgp>
> for information.  My OpenPGP key: <http://romana.hajhouse.org/hajhouse.asc>.
>

--
Mark K. Kim
http://www.cbreak.org/mark/
PGP key available upon request.

_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to