~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fpcdocs/olinuxex/ex29.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
program example29;
 
2
 
 
3
{ Program to demonstrate the LStat function. }
 
4
 
 
5
uses oldlinux;
 
6
 
 
7
var f : text;
 
8
    i : byte;
 
9
    info : stat;
 
10
 
 
11
begin
 
12
  { Make a file }
 
13
  assign (f,'test.fil');
 
14
  rewrite (f);
 
15
  for i:=1 to 10 do writeln (f,'Testline # ',i);
 
16
  close (f);
 
17
  { Do the call on made file. }
 
18
  if not fstat ('test.fil',info) then
 
19
     begin
 
20
     writeln('Fstat failed. Errno : ',linuxerror);
 
21
     halt (1);
 
22
     end;
 
23
  writeln;
 
24
  writeln ('Result of fstat on file ''test.fil''.');
 
25
  writeln ('Inode   : ',info.ino);
 
26
  writeln ('Mode    : ',info.mode);
 
27
  writeln ('nlink   : ',info.nlink);
 
28
  writeln ('uid     : ',info.uid);
 
29
  writeln ('gid     : ',info.gid);
 
30
  writeln ('rdev    : ',info.rdev);
 
31
  writeln ('Size    : ',info.size);
 
32
  writeln ('Blksize : ',info.blksze);
 
33
  writeln ('Blocks  : ',info.blocks);
 
34
  writeln ('atime   : ',info.atime);
 
35
  writeln ('mtime   : ',info.mtime);
 
36
  writeln ('ctime   : ',info.ctime);
 
37
 
 
38
  If not SymLink ('test.fil','test.lnk') then
 
39
    writeln ('Link failed ! Errno :',linuxerror);
 
40
 
 
41
  if not lstat ('test.lnk',info) then
 
42
     begin
 
43
     writeln('LStat failed. Errno : ',linuxerror);
 
44
     halt (1);
 
45
     end;
 
46
  writeln;
 
47
  writeln ('Result of fstat on file ''test.lnk''.');
 
48
  writeln ('Inode   : ',info.ino);
 
49
  writeln ('Mode    : ',info.mode);
 
50
  writeln ('nlink   : ',info.nlink);
 
51
  writeln ('uid     : ',info.uid);
 
52
  writeln ('gid     : ',info.gid);
 
53
  writeln ('rdev    : ',info.rdev);
 
54
  writeln ('Size    : ',info.size);
 
55
  writeln ('Blksize : ',info.blksze);
 
56
  writeln ('Blocks  : ',info.blocks);
 
57
  writeln ('atime   : ',info.atime);
 
58
  writeln ('mtime   : ',info.mtime);
 
59
  writeln ('ctime   : ',info.ctime);
 
60
  { Remove file and link }
 
61
  erase (f);
 
62
  unlink ('test.lnk');
 
63
end.
 
 
b'\\ No newline at end of file'