UNIX Free Pascal


. - 3


begin

writeln(tekkat, ' - '); (**)

halt(1); (* *)

end;

 

d:=opendir(tekkat); (* *)

if d=nil then (* *)

begin

writeln(' opendir ', tekkat); (**)

halt(1); (* *)

end;

elem:=readdir(d); (* *)

while elem<>nil do

begin

(* *)

strcopy(fullpath,tekkat); (* *)

if strcomp(tekkat,'/')<>0 then(* - *)

begin

if fullpath[strlen(fullpath)-1]='/' then (* *)

fullpath[strlen(fullpath)-1]:=#0; (* *)

strcat(fullpath,'/'); (* -*)

end;

strcat(fullpath,elem^.name); (* *)

if not fstat(pchar(fullpath),st) then (* *)

begin

writeln(' ', fullpath); (**)

continue; (* *)

end;

{gmtime_r(st.mtime,mytm);}

writeln(gettype(st.mode),getrights(st.mode),st.nlink:5,

' ',st.size:10,' ',ctime(st.mtime), elem^.name); (* *)

elem:=readdir(d); (* *)

end;

closedir(d); (* opendir *)

end.

 

13.29. vdir.

uses linux,strings,sysutils;

 

function getname(uid:integer):string;

const w='/etc/passwd';

var ts,nam1,namb1:string;

tx:text;

begin

assign(tx,w);

reset(tx);




- -  - -  - -