delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/18/15:57:50

Date: Wed, 18 Apr 2001 22:54:37 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-Id: <2950-Wed18Apr2001225437+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
In-reply-to: <3ADDDAB5.B61AE27B@rz.uni-leipzig.de>
(geissler AT rz DOT uni-leipzig DOT de)
Subject: Re: Problem using setenv
References: <3ADDDAB5 DOT B61AE27B AT rz DOT uni-leipzig DOT de>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019