home *** CD-ROM | disk | FTP | other *** search
- {$m 10000,0,5000}
- program file_dir;
-
- uses
- ufiledir;
-
- begin
- filedir;
- end.
-
- uses
- dos,uenv,fdisks,upath,uexist;
-
- var
- b : byte;
- s : string;
- fn,path : string;
-
- begin
- if paramcount=0 then exit;
- s:=paramstr(1);
- fn:=getfilename(s);
- path:=getpathname(s);
- if path='' then begin
- b:=pos('.*',fn);
- if b>0 then fn[0]:=chr(pred(b));
- if pos('.',fn)=0 then begin
- s:=getpathname(fsearch(fn+'.exe',getenv('path')));
- if s='' then s:=getpathname(fsearch(fn+'.com',getenv('path')));
- end
- else s:=getpathname(fsearch(fn,getenv('path')))
- end
- else begin
- b:=1;
- if (s[0]>#1) and (s[2]=':') then delete(s,1,2);
- if (s<>'') and (s[1]<>'\') then s:='\'+s;
- s:=':'+s;
- if s<>'' then while (b<=lastdisk) and not exist(disks[b]+s,existfile) do inc(b);
- if b<=lastdisk then s:=getpathname(disks[b]+s)
- else begin
- b:=1;
- if s<>'' then while (b<=lastdisk) and not exist(disks[b]+s+'.exe',existfile) do inc(b);
- if b<=lastdisk then s:=getpathname(disks[b]+s+'.exe')
- else begin
- b:=1;
- if s<>'' then while (b<=lastdisk) and not exist(disks[b]+s+'.com',existfile) do inc(b);
- if b<=lastdisk then s:=getpathname(disks[b]+s+'.com');
- end;
- end;
- end;
- if (s<>'') and (s[1]=':') then s:='';
- if s[ord(s[0])]='\' then dec(s[0]);
- if s<>'' then if paramcount>2 then s:=s+'\'+fn;
- if paramcount>1 then halt(ord(not sethauptenv(paramstr(2)+'='+s)))
- else halt(ord(not sethauptenv('what='+s)));
- end.
-