Unit 'BaseUnix' Package
[Overview][Constants][Types][Procedures and functions][Index] [#rtl]

fpLstat

Return information about symbolic link. Do not follow the link.

Declaration

Source position: bunxh.inc line 105

function fpLstat(

  path: PAnsiChar;

  Info: PStat

):cint;

function fpLstat(

  const path: RawByteString;

  Info: PStat

):cint;

function fpLstat(

  path: PAnsiChar;

  var Info: Stat

):cint;

function fpLstat(

  const Filename: RawByteString;

  var Info: Stat

):cint;

Description

FpLstat gets information about the link specified in Path (or FileName, and stores it in Info, which points to a record of type TStat. Contrary to FpFstat, it stores information about the link, not about the file the link points to. The function returns zero if the call was successful, a nonzero return value indicates failure. failed.

Errors

Extended error information is returned by the FpGetErrno function.

sys_enoent
Path does not exist.

See also

FpFStat

  

Retrieve file information about a file descriptor.

#rtl.unixtype.TStatFS

  

Record describing a file system in the unix.fpstatfs call.

Example

program example29;

{ Program to demonstrate the LStat function. }

uses BaseUnix,Unix;

var f : text;
    i : byte;
    info : stat;

begin
  { Make a file }
  assign (f,'test.fil');
  rewrite (f);
  or:=1 to 10 do writeln (f,'Testline # ',i);
  close (f);
  { Do the call on made file. }
  if fpstat ('test.fil',info)<>0 then
     begin
     writeln('Fstat failed. Errno : ',fpgeterrno);
     halt (1);
     end;
  writeln;
  writeln ('Result of stat on file ''test.fil''.');
  writeln ('Inode   : ',info.st_ino);
  writeln ('Mode    : ',info.st_mode);
  writeln ('nlink   : ',info.st_nlink);
  writeln ('uid     : ',info.st_uid);
  writeln ('gid     : ',info.st_gid);
  writeln ('rdev    : ',info.st_rdev);
  writeln ('Size    : ',info.st_size);
  writeln ('Blksize : ',info.st_blksize);
  writeln ('Blocks  : ',info.st_blocks);
  writeln ('atime   : ',info.st_atime);
  writeln ('mtime   : ',info.st_mtime);
  writeln ('ctime   : ',info.st_ctime);

  If  fpSymLink ('test.fil','test.lnk')<>0 then
    writeln ('Link failed ! Errno :',fpgeterrno);

  if  fplstat ('test.lnk',@info)<>0 then
     begin
     writeln('LStat failed. Errno : ',fpgeterrno);
     halt (1);
     end;
  writeln;
  writeln ('Result of fstat on file ''test.lnk''.');
  writeln ('Inode   : ',info.st_ino);
  writeln ('Mode    : ',info.st_mode);
  writeln ('nlink   : ',info.st_nlink);
  writeln ('uid     : ',info.st_uid);
  writeln ('gid     : ',info.st_gid);
  writeln ('rdev    : ',info.st_rdev);
  writeln ('Size    : ',info.st_size);
  writeln ('Blksize : ',info.st_blksize);
  writeln ('Blocks  : ',info.st_blocks);
  writeln ('atime   : ',info.st_atime);
  writeln ('mtime   : ',info.st_mtime);
  writeln ('ctime   : ',info.st_ctime);
  { Remove file and link }
  erase (f);
  fpunlink ('test.lnk');
end.

Documentation generated on: Oct 27 2024