[comp.unix.programmer] c -> environment vars

jac@dobag.in-berlin.de (Joerg Conradt) (04/05/91)

Hello world
is it possible, that a c-programm changes shell (environment) variables?
if yes, how?
thanx Joerg
-- 
UUCP: jac@dobag.in-berlin.de  | - The number of viewers watching you is
Alias Joerg Conradt           |   proportional to the stupidity of your
1000 Berlin 41 Germany        |   action.
++ 0307958397                 | - "Murphy was an optimist"

robtu@itx.isc.com (Rob Tulloh) (04/06/91)

jac@dobag.in-berlin.de (Joerg Conradt) writes:

>Hello world
>is it possible, that a c-programm changes shell (environment) variables?
>if yes, how?
>thanx Joerg

Well, in the man pages on both my RS/6000 and my ISC 386ix box is an entry for 
putenv() which is part of the standard library (libc). Have a look here
for the info you need.

>-- 
>UUCP: jac@dobag.in-berlin.de  | - The number of viewers watching you is
>Alias Joerg Conradt           |   proportional to the stupidity of your
>1000 Berlin 41 Germany        |   action.
>++ 0307958397                 | - "Murphy was an optimist"

Rob Tulloh
--
INTERACTIVE Systems Corp.         Tel: (512) 343 0376 Ext. 116
9442 Capital of Texas Hwy. North  Fax: (512) 343 0376 Ext. 161 (not a typo!)
Arboretum Plaza One, Suite 700    Net: robertt@isc.com (polled daily)
Austin, Texas 78759               GEnie: R.TULLOH (polled monthly)

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (04/07/91)

In article <OWOPWXB@dobag.in-berlin.de> jac@dobag.in-berlin.de (Joerg Conradt) writes:
> Hello world
> is it possible, that a c-programm changes shell (environment) variables?

In other words, that a program change the environment variables of its
parent? The general answer is ``no.'' See the comp.unix.questions
Frequently Asked Questions list for more information.

---Dan

reg@pinet.aip.org (Dr. Richard Glass) (04/07/91)

I have several systems at my disposal and half of them don't have
putenv().  Does it really put the enviornmet var back to the caller?  
Does it do an 'export' as in the Bourne shell?  I know you can add on
vars to the envior. and pass them down.  I know I can RTFM but is late
on Sat. and I feel like getting my two cents in.

Ricky Glass

bergquis@nms.gdc.portal.com (Brett Bergquist) (04/08/91)

In article <1991Apr7.050610.8449@pinet.aip.org>, reg@pinet.aip.org (Dr. Richard Glass) writes:
] I have several systems at my disposal and half of them don't have
] putenv().  Does it really put the enviornmet var back to the caller?  
] Does it do an 'export' as in the Bourne shell?  I know you can add on
] vars to the envior. and pass them down.  I know I can RTFM but is late
] on Sat. and I feel like getting my two cents in.
] 
] Ricky Glass


You should look at the man page for syslog.conf(5).  All you have to do
is add ",/pathtofilename" to each entry that has "/dev/console" in it.  This
will send all messages that appear on the console to the named file.  After
you edit "/etc/syslog.conf", you will have to send syslogd(8) a SIGHUP so
that it will reread this file.

Hope this help!
-- 
Brett M. Bergquist, Principal Engineer | "Remind me" ... "to write an
General DataComm, Inc.,                | "article on the compulsive reading
Middlebury, CT 06762                   | of news." - Stranger in a Strange Land
Email: bergquis@nms.gdc.portal.com  or ...!portal!gdc!nms!bergquis