PROGRAM SAMPGET;
{
    This TURBO PASCAL program is used to show how to use the $INCLUDE
    file GETDIR.PAS.   These include file is a re-work of one found in
    Borland's Sig database on Compuserve written by Jim McCarthy,
    Technical Support at Borland.   It is specific to PCDos or MSDos
    2.0 or higher for the IBM/PC/XT or BIOS compatable.
}
VAR
    Mask    :   String[80];
    filename :  string[80];
    done    :   boolean;
    error   :   integer;
    online  :   integer;
    i       :   integer;

{$I GetDir.PAS}

procedure printname(filename:string80);
begin
   write(filename); write(copy('              ',1,14-length(filename)));
   online:=online+1;
   if online = 5 then
      begin
      writeln;
      online:=0;
      end;
end;

BEGIN
   online:=0; error:=0;
   DirSetup('INIT',error);
   done:=false;
   if error <> 0 then done:= true;
   While not done do
     BEGIN
       Write('Enter mask:');
       Readln(Mask);
       writeln(mask);
       If Mask = '' then done := true;
       if not done then dirget('FIRST',mask,filename,31,error);
       if error <> 0 then done:= true;
       if not done then printname(filename);
       while error = 0 do
         BEGIN
           dirget('NEXT',mask,filename,31,error);
           if error <> 0 then done:= true;
           if not done then printname(filename);
         END;
     END;
     writeln;
     write ('last error was:'); writeln(error);
     DirSetup('FINISH',error);
     write('setup err:'); writeln(error);
END.
                                                                                                            