Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 734 Bytes

findit.pas

File metadata and controls

34 lines (26 loc) · 734 Bytes
 
Nov 18, 2000
Nov 18, 2000
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
uses dos;
var s,spath:string;
ps:dirstr;
ns:namestr;
es:extstr;
notfound:boolean;
begin
writeln;
writeln('Find EXE/COM/BAT files on the PATH.');
writeln;
writeln('Enter commandline:');
write(':'); readln(s);
while (copy(s,1,1)=' ') do s:=copy(s,2,length(s)-1);
fsplit(s,ps,ns,es);
notfound:=FALSE;
s:=ns+'.EXE'; spath:=fsearch(s,getenv('PATH'));
if (spath='') then begin
s:=ns+'.COM'; spath:=fsearch(s,getenv('PATH'));
if (spath='') then begin
s:=ns+'.BAT'; spath:=fsearch(s,getenv('PATH'));
if (spath='') then notfound:=TRUE;
end;
end;
if (not notfound) then spath:=fexpand(spath);
if (notfound) then writeln('Not found.') else writeln('Found: '+spath);
end.