home *** CD-ROM | disk | FTP | other *** search
-
- (*
- * getfile2 - file list processing library (simplified version)
- *
- * This module will change a wildcard list of files into a
- * sorted file name list.
- *
- * Samuel H. Smith, rev. 25-oct-87
- *
- *)
-
- procedure getfiles (pattern: string;
- var fdir: filearray;
- var num: integer);
- var
- i: integer;
- curdir: string;
- keyword: string13;
- doscan: boolean; {can dos do this wildcard?}
- DirInfo: SearchRec;
-
- begin
- stoupper(pattern);
- curdir := path_only(pattern);
- keyword := remove_path(pattern);
-
- doscan := true;
- i := pos('*',keyword);
- if i > 0 then
- if (keyword[i+1] <> '.') and (i < length(keyword)) then
- doscan := false;
-
- if doscan = false then
- pattern := curdir + '*.*';
-
- num := 0;
- FindFirst(pattern,$21,DirInfo);
-
- while (DosError = 0) and (num < maxnumfiles) do
- begin
- if doscan then
- begin
- inc(num);
- savestr(fdir[num],curdir + DirInfo.name);
- end
- else
-
- if wildcard_match(keyword, DirInfo.name) then
- begin
- inc(num);
- savestr(fdir[num],curdir + DirInfo.name);
- end;
-
- FindNext(DirInfo);
- end;
-
- if num >= maxnumfiles then
- writeln('Warning: Files in excess of ', maxnumfiles, ' ignored.');
-
- end; {getfiles}
-
-