UNIX Free Pascal


. proc - 2


while elem<>nil do (* *)

begin

(* *)

val(strpas(elem^.name),number,coder);

(* , *)

if coder=0 then

begin

(* status /proc/_/status *)

strcopy(fullpath,'/proc/');

strcat(fullpath,elem^.name);

strcat(fullpath,'/status');

(* *)

assign(f,fullpath);

reset(f);

readln(f,name);

close(f);

(* , *)

strlcopy(realname,@name[7],length(name));

realname[length(name)-6]:=#0;

(* *)

writeln(number,#9,realname);

end;

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

end;

closedir(d); (* opendir *)

end.

 

13.37. /proc, .

uses linux,strings,sysutils; (* Linux PChar*)

 

var

d,d1:^TDir; (* *)

elem,elem1:^Dirent; (* , *)

realname, (* status*)

fullpath,fullpath1 (* *)

:array [0..1000] of char;

number,coder:integer; (* *)

f:text;

name:string;

begin

d:=opendir('/proc'); (* *)

if d=nil then (* *)

begin

writeln(' opendir /proc'); (**)

halt(1); (* *)

end;




- -  - -  - -