Setenv from C
Mikel Manitius
mikel at codas.UUCP
Sun Oct 6 13:13:48 AEST 1985
> /*
> > Is it possible to set a csh environment variable within a C program? I know
> > about getenv(), but have failed at attempts to set an environment variable
> > from a C program. Basically, what I want to do is "source" a new environment
> > variable for the current csh process. Any comments or suggestions would be
> > appreciated. Thanks.
>
> In a word NO! There is no way to affect your parent's environment unless
> they made prior arrangements (like before you were born) to do so.
> Sounds kinda like Life, doesn't it?
>
> [ ... examples of kludges deleted ... ]
Yet Another Way Neglected (kind of like YACC, but YAWN :-}):
eval `prog`
have "prog" generate the following output:
set home=/usr/mikel
setenv FOOBAR dodo
For further usage of eval, consult your manuals.
--
=======
Mikel Manitius ==----===== AT&T
(305) 869-2462 RNX: 755 ==------===== Information Systems
...{akguc|ihnp4}!codas!mikel ===----====== SDSS Regional Support
...attmail!mmanitius =========== Altamonte Springs, FL
My opinions are my own. =======
More information about the Comp.lang.c
mailing list