Mail Archives: djgpp-workers/1999/04/13/06:34:07
On Tue, 13 Apr 1999, Hans-Bernhard Broeker wrote:
> > set OLDPATH=%PATH%
> > set PATH=C:\DJGPP\BIN;%PATH%
> > if not "%PATH%"=="C:\DJGPP\BIN;%OLDPATH%" echo ERROR
>
> Unless my knowledge on command.com is completely failing me, here, this
> will not work at all. A 'filled close to overflowing' PATH variable is one
> that is almost as long as the DOS command line lenght limit (around 127
> chars).
That's right, the above is for the case that the environment is full,
not PATH itself. Sorry for a misleading message.
One way to detect the next-to-full PATH would by to call `system'.
Hmm, now that I think about this, maybe calling `system' to run
AUTOEXEC.BAT, and then examining the results in the environment *is*
the way to deal with many of the complexities which were mentioned in
this thread? (Just remember to set the bit in __system_flags that
causes it to always invoke COMMAND.COM, or, even better, call
COMMAND.COM explicitly:
ret = system ("command.com /c cfgcheck.bat");
where cfgcheck.bat is something like this:
@echo off
call C:\autoexec.bat
set > envlist.txt
Then examine envlist.txt to know what does autoexec.bat do. For example,
a problem with a full PATH might be detected if its length is exactly 126
characters, or if it ends with a `;'.
You can even simulate a given environment by setting CONFIG to it before
running autoexec.bat.
- Raw text -