Maurice Lombardi wrote:
Hi all I have found a couple of small bugs in the last beta gpc-19990118.i386-pc-djgppv201.zip when using LFN=n 8.3 limitation in DOS 6.2
The problem comes from the fact that in this situation DOS makes uppercase all filenames. FindFirst/FindNext in the dos.pas unit has an odd behavior displayed by the following short program:
program ff; uses dos; var F:SearchRec; begin FindFirst('ff.pas',Anyfile,F); writeln('l ',DosError); FindFirst('FF.PAS',Anyfile,F); writeln('u ',DosError); end.
DJGPP answers l 0 u 18 i.e. it does NOT recognize the UPPERCASE filename, finding only the lowercase one.
In the same situation BP answers l 0 u 0 i.e. it recognizes both.
The defect can be traced to the function MatchPart in the FindNext procedure. Correction need to be done only under DJGPP (at compilation time) when LFN=n at execution time. A possible solution is given by the attached diff.
Thanks for the report. I fixed this -- actually a bit more general: I put into the RTS a new constant FileNamesCaseSensitive and a new function FLoCase to convert a character to lower case if FileNamesCaseSensitive is False and leave it unchanged otherwise, and use them in the Dos unit, so that unit doesn't need any ifdefs.
However, I'm not sure about when FileNamesCaseSensitive should be set to False: First of all, I think it should be on all __OS_DOS__ platforms, not only __DJGPP__. Then, what about the LFN stuff? I haven't used such a system, but I've read that it's not really case-sensitive (something like, the case of the files as given on creation is stored, but matching is still insensitive). If that's so, FileNamesCaseSensitive should still be False, and we don't have to check LFN. Can anyone confirm or deny?
Similarly the environment names are always capitalized, so that GetEnv('path') and GetEnv('PATH') give the same result as displyed in the following short program:
program ge; uses dos; var F:SearchRec; begin writeln('LFN=',GetEnv('LFN')); writeln('ll ',FSearch('rhide.exe',GetEnv('path'))); writeln('uu ',FSearch('RHIDE.EXE',GetEnv('PATH'))); writeln('lu ',FSearch('rhide.exe',GetEnv('PATH'))); end.
BTW, something unrelated to your request: when searching for an executable, you might prefer to use:
FSearchExecutable ('rhide', GetEnv (PathEnvVar));
This searches for `rhide.com', `rhide.exe' and `rhide.bat' under Dos (so you get more flexibility there), and on other systems for `rhide' without extension (so it works there, too) and only with executable permission (so it's safer than "FSearch ('rhide', ...)" there). PathEnvVar is currently 'PATH' on all systems, but one never knows what will happen... ;-)
BTW, FSearchExecutable and PathEnvVar need the `gpc' unit rather than `dos' (and `FSearch' and `GetEnv' are also present in `gpc' as well as in `dos').
DJGPP in DOS 6 with LFN=n answers:
LFN=n ll uu F:\DJGPP\BIN\RHIDE.EXE lu F:\DJGPP\BIN\rhide.exe
whereas in BP gives always (even in a W95 dos box)
LFN= ll F:\DJGPP\BIN\rhide.exe uu F:\DJGPP\BIN\RHIDE.EXE lu F:\DJGPP\BIN\rhide.exe
This behavior of automatic capitalization of environment variables is so strange that I am not sure it must be reproduced in a unit which aims at portability: I think that nearly everybody would write naturally programs with environment variables uppercase as displayed by the set command.
Actually, I have changed this after 19990118 (only for Dos, of course, not affecting other systems where case matters). This is the corresponding entry from the `Fixed bugs' section of the To-Do list (http://agnes.dida.physik.uni-essen.de/~gnu-pascal/todo.html):
19990202: Dos-like systems: convert parameter to GetEnv and CGetEnv to upper case (actually, libc should do so)
A completely different bug is in the crt unit. Readkey returns #10 i.e. linefeed when one hits the return as well as the ^M keys which should be #13. THis is very strange since the demo program testcurs.c which comes with the sources of PDcurses has the correct behavior.
Oh yes, these CR/LF stuff is a bit nasty because if seems to depend on a number of things like terminal modes, which are affected by CheckBreak (perhaps a bug in PDCurses, at least a bit of undocumented behaviour there ;-). I changed CRT a little after 1990118, hope this will also fix the symptom you've experienced:
19990202: DJGPP: CRT: ReadKey returns #10, not #13, for the enter key when CheckBreak is True
Frank
Hi
On Sat, Apr 03, 1999 at 12:41:35AM +0200, Frank Heckenbach wrote:
However, I'm not sure about when FileNamesCaseSensitive should be set to False: First of all, I think it should be on all __OS_DOS__ platforms, not only __DJGPP__. Then, what about the LFN stuff? I haven't used such a system, but I've read that it's not really case-sensitive (something like, the case of the files as given on creation is stored, but matching is still insensitive). If that's so, FileNamesCaseSensitive should still be False, and we don't have to check LFN. Can anyone confirm or deny?
Yes, VFAT filesystems are case preserving but case insensitive. This variable should be False regardless of the setting of LFN.
On the occasion I would like to ask if anyone has successfully used DJGPP and Borland protected mode tools simultaneusly? Borland's DPMI host only supports 16-bit DPMI while DJGPP needs 32-bit, and CWSDPMI only supports 32-bit. Windows has its own DPMI host, but both Borland tools and DJGPP tools give loader error messages if I try to call one from another. It's unfortunate so that I cannot use, for example, GNU make with bpc. GPC is not yet a suitable replacement (read: no Turbo Vision). Keep up the good work anyway!
Yours, Marius Gedminas http://www-public.osf.lt/~mgedmin/ -- We don't care. We don't have to. We're the Phone Company.
Marius Gedminas wrote:
Yes, VFAT filesystems are case preserving but case insensitive. This variable should be False regardless of the setting of LFN.
Don't we need an additional variable `CasePreserving' then which is false on FAT but true on VFAT filesystems?
Even worse: This needn't be a constant for one OS but depends on the path you are accessing. A file on a FAT filesystem mounted under Linux has LFN=CaseSensitive=CasePreserving=false.
On the occasion I would like to ask if anyone has successfully used DJGPP and Borland protected mode tools simultaneusly? Borland's DPMI host only supports 16-bit DPMI while DJGPP needs 32-bit, and CWSDPMI only supports 32-bit. [...]
Some time ago, I successfully called EMX 32-bit DPMI programs from BP 16-bit DPMI programs with RSX. I was not able to reproduce this for DJGPP, but maybe you can substitute EMX? (M$ in Their wisdom explicitely forbid 16-bit and 32-bit DPMI clients to coexist, but the EMX/RSX folks are proud of this "bug".;-)
GPC is not yet a suitable replacement (read: no Turbo Vision). Keep up the good work anyway!
The port of Free Vision to GPC is currently being worked on. Be welcome to join the project, so it will become usable sooner.
Peter
On Sat, Apr 03, 1999 at 12:29:12PM +0200, Peter Gerwinski wrote:
Don't we need an additional variable `CasePreserving' then which is false on FAT but true on VFAT filesystems?
What would it be used for?
Even worse: This needn't be a constant for one OS but depends on the path you are accessing. A file on a FAT filesystem mounted under Linux has LFN=CaseSensitive=CasePreserving=false.
I really think there is no need to go into that level of details. Other Linux programs do not care for this, why should programs compiled with GPC be an exception?
On the occasion I would like to ask if anyone has successfully used DJGPP and Borland protected mode tools simultaneusly? Borland's DPMI host only supports 16-bit DPMI while DJGPP needs 32-bit, and CWSDPMI only supports 32-bit. [...]
Some time ago, I successfully called EMX 32-bit DPMI programs from BP 16-bit DPMI programs with RSX. I was not able to reproduce this for DJGPP, but maybe you can substitute EMX? (M$ in Their wisdom explicitely forbid 16-bit and 32-bit DPMI clients to coexist, but the EMX/RSX folks are proud of this "bug".;-)
Does EMX have a separate DPMI server (like CWSDPMI), or is it only useful for EMX programs (like Borland's DPMI16BI.OVL)?
GPC is not yet a suitable replacement (read: no Turbo Vision). Keep up the good work anyway!
The port of Free Vision to GPC is currently being worked on. Be welcome to join the project, so it will become usable sooner.
I cannot promise much due to lack of free time, but it's already been some time since I last inspected Free Vision. Is there a home page for it now?
Yours, Marius Gedminas http://www-public.osf.lt/~mgedmin/ -- We don't care. We don't have to. We're the Phone Company.