Ñèñòåìíîå ïðîãðàììèðîâàíèå â UNIX ñðåäñòâàìè Free Pascal


         

Îøèáêà âûçîâà stat äëÿ


                                 '---', {0}

                                 '--t', {1}

                                 '-s-', {2}

                                 '-st', {3}

                                 's--', {4}

                                 's-t', {5}

                                 'ss-', {6}

                                 '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;

procedure obhod(name:pchar);

var

  d:PDIR;

  el:pdirent;

  st:stat;

  res:integer;

  dt:tdatetime;

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

  i,k:integer;

begin

  d:=opendir(name);

  if d=nil then

  begin

    writeln('Îøèáêà îòêðûòèÿ êàòàëîãà ',name);

    exit;

  end;

  i:=0;

  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

      (*

      strcopy(datetime,ctime(@st.mtime)+4);

      datetime[12]:=#0;

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

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

      *)

      if(gettype(st.mode)='d') then

        textcolor(9);

      if(gettype(st.mode)='-') and strchr(getrights(st.mode),'x') then

        textcolor(lightgreen);


Ñîäåðæàíèå  Íàçàä  Âïåðåä