Системное программирование в UNIX средствами Free Pascal


         

Ошибка вызова stat для


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

begin

  d:=opendir(name);

  if d=nil then

  begin

    writeln('Ошибка открытия каталога ',name);

    exit;

  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

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

      writeln(el^.name);

    end;

    el:=readdir(d);

  end;

 

  closedir(d);

  d:=opendir(name);

  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,'/');


Содержание  Назад  Вперед





Forekc.ru
Рефераты, дипломы, курсовые, выпускные и квалификационные работы, диссертации, учебники, учебные пособия, лекции, методические пособия и рекомендации, программы и курсы обучения, публикации из профильных изданий