mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 19:29:09 +02:00
* another Find* problem :-(
This commit is contained in:
parent
bf7400c7cf
commit
d6f289a9df
@ -28,7 +28,7 @@ interface
|
|||||||
|
|
||||||
{$PACKRECORDS 1}
|
{$PACKRECORDS 1}
|
||||||
|
|
||||||
uses strings;
|
uses Strings, DosCalls;
|
||||||
|
|
||||||
const {Bit masks for CPU flags.}
|
const {Bit masks for CPU flags.}
|
||||||
fcarry = $0001;
|
fcarry = $0001;
|
||||||
@ -65,7 +65,8 @@ type {Some string types:}
|
|||||||
searchrec=record
|
searchrec=record
|
||||||
case boolean of
|
case boolean of
|
||||||
false: (handle:longint; {Used in os_OS2 mode}
|
false: (handle:longint; {Used in os_OS2 mode}
|
||||||
fill2:array[1..21-SizeOf(longint)] of byte;
|
FStat:PFileFindBuf3;
|
||||||
|
fill2:array[1..21-SizeOf(longint)-SizeOf(pointer)] of byte;
|
||||||
attr2:byte;
|
attr2:byte;
|
||||||
time2:longint;
|
time2:longint;
|
||||||
size2:longint;
|
size2:longint;
|
||||||
@ -178,8 +179,6 @@ function getenv(const envvar:string): string;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses DosCalls;
|
|
||||||
|
|
||||||
var LastSR: SearchRec;
|
var LastSR: SearchRec;
|
||||||
envc: longint; external name '_envc';
|
envc: longint; external name '_envc';
|
||||||
EnvP: ppchar; external name '_environ';
|
EnvP: ppchar; external name '_environ';
|
||||||
@ -772,7 +771,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DosSearchRec2SearchRec (var F: SearchRec; FStat: PFileFindBuf3);
|
procedure DosSearchRec2SearchRec (var F: SearchRec);
|
||||||
|
|
||||||
const NameSize=255;
|
const NameSize=255;
|
||||||
|
|
||||||
@ -823,9 +822,6 @@ procedure FindFirst (const Path: PathStr; Attr: word; var F: SearchRec);
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
|
||||||
FStat: PFileFindBuf3 = nil;
|
|
||||||
|
|
||||||
var path0: array[0..255] of char;
|
var path0: array[0..255] of char;
|
||||||
Count: longint;
|
Count: longint;
|
||||||
|
|
||||||
@ -834,24 +830,22 @@ begin
|
|||||||
DosError := 0;
|
DosError := 0;
|
||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
begin
|
begin
|
||||||
New (FStat);
|
New (F.FStat);
|
||||||
F.Handle := $FFFFFFFF;
|
F.Handle := $FFFFFFFF;
|
||||||
Count := 1;
|
Count := 1;
|
||||||
DosError := DosFindFirst (Path, F.Handle, Attr, FStat,
|
DosError := DosFindFirst (Path, F.Handle, Attr, F.FStat,
|
||||||
SizeOf (FStat^), Count, ilStandard);
|
SizeOf (F.FStat^), Count, ilStandard);
|
||||||
if (DosError = 0) and (Count = 0) then DosError := 18;
|
if (DosError = 0) and (Count = 0) then DosError := 18;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
strPcopy(path0,path);
|
strPcopy(path0,path);
|
||||||
_findfirst(path0,attr,f);
|
_findfirst(path0,attr,f);
|
||||||
end;
|
end;
|
||||||
DosSearchRec2SearchRec (F, FStat);
|
DosSearchRec2SearchRec (F);
|
||||||
if os_mode = osOS2 then Dispose (FStat);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FindNext (var F: SearchRec);
|
procedure FindNext (var F: SearchRec);
|
||||||
var FStat: PFileFindBuf3;
|
var Count: longint;
|
||||||
Count: longint;
|
|
||||||
|
|
||||||
procedure _findnext(var f : searchrec);
|
procedure _findnext(var f : searchrec);
|
||||||
|
|
||||||
@ -872,13 +866,11 @@ begin
|
|||||||
SearchRec2DosSearchRec (F);
|
SearchRec2DosSearchRec (F);
|
||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
begin
|
begin
|
||||||
New (FStat);
|
|
||||||
Count := 1;
|
Count := 1;
|
||||||
DosError := DosFindNext (F.Handle, FStat, SizeOf (FStat), Count);
|
DosError := DosFindNext (F.Handle, F.FStat, SizeOf (F.FStat^), Count);
|
||||||
if (DosError = 0) and (Count = 0) then DosError := 18;
|
if (DosError = 0) and (Count = 0) then DosError := 18;
|
||||||
end else _findnext (F);
|
end else _findnext (F);
|
||||||
DosSearchRec2SearchRec (F, FStat);
|
DosSearchRec2SearchRec (F);
|
||||||
if os_mode = osOS2 then Dispose (FStat);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FindClose (var F: SearchRec);
|
procedure FindClose (var F: SearchRec);
|
||||||
@ -886,6 +878,7 @@ begin
|
|||||||
if os_mode = osOS2 then
|
if os_mode = osOS2 then
|
||||||
begin
|
begin
|
||||||
DosError := DosFindClose (F.Handle);
|
DosError := DosFindClose (F.Handle);
|
||||||
|
Dispose (F.FStat);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1067,7 +1060,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2001-03-10 09:57:51 hajny
|
Revision 1.9 2001-03-11 18:58:42 hajny
|
||||||
|
* another Find* problem :-(
|
||||||
|
|
||||||
|
Revision 1.8 2001/03/10 09:57:51 hajny
|
||||||
* FExpand without IOResult change, remaining direct asm removed
|
* FExpand without IOResult change, remaining direct asm removed
|
||||||
|
|
||||||
Revision 1.7 2001/02/04 01:57:52 hajny
|
Revision 1.7 2001/02/04 01:57:52 hajny
|
||||||
|
Loading…
Reference in New Issue
Block a user