summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw14020.pp
blob: 8e4d06d60782b7e9f56f52e1a249545e7504a2b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ %target=linux,freebsd,darwin,solaris,haiku }

program project1;

uses
  SysUtils;

var
  rSearch: TSearchRec;
  lsName, lsSearch: String;
  bDone:   Boolean;
begin
  { for all files in the dir }
  lsSearch := './' + AllFilesMask; //fails to find anything
  WriteLn(lsSearch);

  FillChar(rSearch, Sizeof(TSearchRec), 0);
  bDone := (FindFirst(lsSearch, 0, rSearch) <> 0);

  while not bDone do
  begin
    lsName := rSearch.Name;
    Assert(lsName <> '');
    if (rSearch.Attr and faDirectory > 0) then
      continue;

    { if we find one file, it's ok }
    findclose(rsearch);
    halt(0);

    bDone := (FindNext(rSearch) <> 0);
    Assert(bDone or (rSearch.Name <> lsName));
  end;
  FindClose(rSearch);
  halt(1);
end.