Mail Archives: djgpp/2001/04/18/15:57:50
> From: "H.-G. Geissler" <geissler AT rz DOT uni-leipzig DOT de>
> Newsgroups: comp.os.msdos.djgpp
> Date: Wed, 18 Apr 2001 20:19:33 +0200
>
> I cannot set dos environment variables with setenv.
> Set variables are readable within the same program using getenv but are
> not persistent through
> subsequent invocations of the program. They appear not in DOS if I try
> "set".
It sounds like you are trying to change the parent environment. This
is impossible, in DOS/Windows as in Unix and GNU/Linux. A program can
only affect the environment of its child programs, but not the
environment of its parent shell. So setenv is not supposed to do what
you are trying to accomplish.
That said, there are many programs floating around that can work
around this basic limitation by walking the DOS memory chain and
modifying it. You will probably find some of them on SimTel, together
with their source code. You could, in principle, rewrite those
programs so that they work in DJGPP (using farptr or nearptr functions
to access DOS memory), and then replace the library version of setenv
with that code.
- Raw text -