Mail Archives: opendos/1997/03/06/09:31:42
Hi!
[Environment is case-sensitive?]
> > OpenDOS is internally case-sensitive in environment operations.
> >
> > When I've changed the 'set path=c:\opendos' to 'set PATH=c:\opendos' in
> > dconfig.sys - everything went just OK.
> >
> > Conclusion: OpenDOS internally pays attention to the env. variable's case and
> > programs that do 'getenv("PATH")' receive NULL. Or... what else could it be?
There is a great difference between the CONFIG.SYS pre-environment
and its related SET= directive, and the later environment, to be used
in batchjobs...
The normal environment functions (batchjobs) are not case-sensitive,
that is, if you set new environment variables, they will be upstringed
before they appear in the environment. If you test on environment
variables e.g. using IF "%var1%"=="%var2%" ..., both sides are
upstringed.
However, the CONFIG.SYS SET= directive works very different:
- It does *not* upstring variables before putting them into the
pre-environment.
- It does not clear or overwrite already existing entries.
In fact, if you do:
SET test=Hello
SET test=World!
SET test=
SET path=c:\opendos
the pre-environment will actually contain:
test=Hello
test=World!
test=
path=c:\opendos
Some may call this a bug, but it's also a feature, if it's known...
(Mind, that a pre-environment was introduced with DR DOS 6.0, long
before MS-DOS 6.0 did it rather differently).
Normally, when loading COMMAND.COM via SHELL = /P, it will parse
the pre-environment and create a master-environment from it,
stripping out those doubled definitions, and so forth...
It will *not* upstring these strings! When using these variables
in batchjobs, there won't be problems, since the variables will be
upstringed before the test. If you use your compilers runtime
library functions, depending on your compiler, you need to test
for both, upcase and lowcase variants, which, of course, is not
very convenient. You may patch your RTL (if I remember well,
Borland/Turbo Pascal libraries upstring the environment
internally). However, you always need to upstring the resulting
string (and always had to do this in the past).
4DOS & NDOS do not evaluate the pre-environment, when they build
the master-environment from it. They just take it over.
So, strange side effects appear with these command processors,
if you don't upstring all your CONFIG.SYS SET= directives.
To avoid some of the problems, 4DOS & NDOS have with DR DOS style
pre-environments, you should insert:
IF "4"=="%@Eval[2+2]%" c:\opendos\command.com /C EXIT
at the beginning of your AUTOEXEC.BAT file. This lets COMMAND.COM
do some changes in the kernel structures, that 4DOS/NDOS won't
do, but that are required for optimal stability, e.g. closing
the pre-environment. Of course, these are items, that should be
added to 4DOS, but since we don't have the sources, JP has to do
it themselfs.
For more details refer to Caldera's OpenDOS mailing list archive,
or my comprehensive tips & tricks document NWDOSTIP.TXT (from
MPDOSTIP.ZIP).
[Spaces in environment variables]
> In addition, the SET command has something wierd about it.
>
> My SET BLASTER line used to read thus:
>
> SET BLASTER = A220 I7 D1 T4
>
> But numerous programs fell over and said that the soundcard was gone.
> A lot of fiddling and recompiling later, I discovered that it would only
> work if it read:
>
> SET BLASTER=A220 I7 D1 T4
>
> If you put spaces in it, getenv("BLASTER=") returned NULL.
>
> This never happened with DRDOS.
>
Yes, there were some fixes with the Novell DOS updates, that
apparently cannot yet be found in OpenDOS. Install the latest
Novell DOS update on your OpenDOS system, or don't use spaces
before and directly after the equal sign. Also, don't use
spaces at the end of the value, for example, if you would do:
SET test=Hello World! > \dev\nul
^---- don't set spaces here!!!
^---- this space should (and will) remain!!!
^^^--- spaces may be stripped of or not, depending on
your implementation
Novell DOS/OpenDOS (and MS-DOS before 7) won't have problems
with these, since they strip off pending spaces, but MS-DOS 7
does not!!!
Bye,
Matthias
------------------------------------------------------------------
Matthias Paul ! My eMail address has changed. For some time !
Ubierstrasse 28 ! mails to former <MPaul AT ibh DOT rwth-aachen DOT de> !
D-50321 BRUEHL ! will be forwarded to the new address. !
eMail: <Matthias DOT Paul AT post DOT rwth-aachen DOT de>
WWW : URL: http://www.rhrz.uni-bonn.de/~uzs180/mpdokger.html
------------------------------------------------------------------
- Raw text -