UNIX Free Pascal


. - 5


'sst' {7}

);

var

s,u,g,o,i:integer;

res:string;

begin

mode:=mode and octal(7777);

u:=(mode div octal(100)) mod octal(10);

g:=(mode mod octal(100)) div octal(10);

o:=mode mod octal(10);

s:=mode div octal(1000);

res:=sympr[u]+sympr[g]+sympr[o];

for i:=1 to 3 do

if specsympr[s][i]<>'-' then

begin

if res[3*i]='-' then

res[3*i]:=upcase(specsympr[s][i])

else

res[3*i]:=specsympr[s][i];

end;

getrights:=res;

end;

 

var

d:PDIR;

el:pdirent;

st:stat;

res:integer;

dt:tdatetime;

polniypath,name:array [0..2000] of char;

 

begin

if paramcount = 0 then

name:='.'

else

name:=paramstr(1);

 

d:=opendir(name);

if d=nil then

begin

writeln(' ');

halt(0);

end;

 

el:=readdir(d);

while el<>nil do

begin

polniypath:=name;

if strcomp(name,'/')=0 then

strcat(polniypath,el^.name)

else

begin

if name[strlen(name)-1]<>'/' then

strcat(polniypath,'/');

strcat(polniypath,el^.name);

end;

if not fstat(pchar(polniypath),st) then

writeln(' stat ',polniypath)

else

begin

{writeln(polniypath,' ',s.size);}

dt:=filedatetodatetime(st.mtime);

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

getname(st.uid),' ',getgroup(st.gid),st.size:10,' ',datetimetostr(dt),' ' );

writeln(el^.name);

end;

el:=readdir(d);

end;

closedir(d);

end.

 

13.30. ls, ( ".") . , . "." ".." .

uses linux,strings,sysutils,crt;

 

{$linklib c}

 




- -  - -  - -