Hi all,
on system with long file name support activated (I have FreeDos with doslfn), the example below types all files instead of directory only.

program test;
uses dos;
var f:searchrec;
begin
findfirst('*',directory,f);
while doserror=0 do begin
writeln(f.name);
findnext(f);
end;
findclose(f);
end.

Looking at the Ralph Brown's list I found the problem which arises as the attribute value must be loaded twice in the cx register in his low and high halves for (respectively) the allowable and required search criteria. Changes to accomplish that are in the diff attached, $37 is AnyFile constant cleared of the volume label bit. A total different point: in the zip file of the source of the compiler all texts are in the Unix end line format, the result are broken recompilation process on Dos'es. Maybe it would be better to convert it, Info-Zip has a specific option during compression.
Marco
759c759
< procedure LFNFindFirst(path:pchar;attr:longint;var s:searchrec);
---
> procedure LFNFindFirst(path:pchar;attr:word;var s:searchrec);
768,769c768,772
<   if attr=$8 then
<    dosregs.ecx:=8
---
>   if attr<>$8 then
>    attr:=attr and (not 8);
>   dosregs.cl:=lo(attr);
>   if attr<>$37 then
>    dosregs.ch:=lo(attr)
771c774
<    dosregs.ecx:=attr and (not 8);
---
>    dosregs.ch:=0;
871c874
<   dosregs.ecx:=attr;
---
>   dosregs.cx:=attr;
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to