freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] Re: djgpp and uppercase vs. lowercase file names


From: Antoine Leca
Subject: Re: [Devel] Re: djgpp and uppercase vs. lowercase file names
Date: Mon, 22 Nov 2004 13:32:56 +0100

On Sunday, November 21st, 2004 13:54Z Werner LEMBERG va escriure:

>>> Currently, we test for Windows NT by checking the `OS' environment
>>> variable whether it contains `Windows_NT'.
>>>
>>> We check for win32 by testing whether COMSPEC is defined and the
>>> output of the `ver' program contains the string `Windows'.
>>
>> But that would include DOS-based (i.e. not Win32) versions of
>> Windows like 3.1.
>
> Any idea how to handle this gracefully?

Win32 means either Windows NT or Windows 9X (for the other cases, Win32S you
should forget about it, and about Odin/Wine and similar things I believe
overrides are the ways to go).
NT you already have it. BTW, CMD.EXE is available on NT (or OS/2) but
unavailable on 9X, so your basic problem is already solved, but you'll left
with a disperfect solution on 9X, won't you?

So the problem melts down to detect 9X; then VER is the correct way to go:
VER on pre-9X will return "DOS version x.xx"; with Windows 95 this was
changed to "Windows version 95", in an intent to pretend that DOS was dead.
A nice side thing here is that NT VER also outputs "Windows", so one shot
will do the whole trick.
Perhaps a bit of additional comments will be a good idea here. I perhaps can
do it if you indicate me what are the lines you were consulting.

The problem then is to detect if you are running full-blown 9X (and Win32,
and long filenames, are available), or if you are merely running "DOS 7.x",
i.e. the underlying DOS in real mode but not the Windows kernel etc. (this
can be done with GUI=0 or choosing an option at boottime). DJGPP runs well
in both cases, but in the second case there are no Win32 nor long filenames
in sight. The method above will give the wrong answer. Basically, there are
two options at this point:
 - consider this case is not important and should be user-overriden (i.e.,
document in README)
 - trying to detect plain DOS.

To do the latter, here is a possibility:

With plain DOS 7.x mode, only %winbootdir% is defined (note the lowercase).

With Windows 9X fully loaded, both %winbootdir% AND %windir% are defined
(they _can_ be different, but there is a very tiny possibility that they are
actually are different)

With Windows 3.x, there is neither %windir% nor %winbootdir%.

With NT, only %windir% is defined, no %winbootdir%.

Beware here: NT's COMMAND.COM (actually a stripped down execution of
CMD.EXE) does not "see" the lowercase environment variables. But the full
fledged CMD.EXE does; so this melts down into just test for system("ECHO
%windir%") as a way to detect win32/longnames: anything different of
"%windir%" means there are available :-)



>> But you *can* check the existence of %windir%\system32\cmd.exe and
>> use it if you find it (or is it better to use
>> %SystemRoot%\system32\cmd.exe instead?).
>
> Is %windir% and %SystemRoot% always defined?

On NT, yes.
%SystemRoot% is never defined on 9X.
For %windir% see above.


Antoine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]