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

« back to all changes in this revision

Viewing changes to fpcdocs/olinuxex/ex14.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 Example14;
 
2
 
 
3
{ Program to demonstrate the Fork and WaitPidfunction. }
 
4
 
 
5
Uses oldlinux;
 
6
 
 
7
Var PID, ExitStatus : Longint;
 
8
 
 
9
begin
 
10
  Writeln ('Spawning a child');
 
11
  PID:=Fork;
 
12
  If PID=0 then
 
13
    begin
 
14
    Writeln ('Hello From the Child !!');
 
15
    Writeln ('Exiting with exit status 1 !');
 
16
    Halt (1);
 
17
    end
 
18
  Else
 
19
    begin
 
20
    Writeln ('Spawned child with PID : ',PID);
 
21
    WaitPid (PID,@ExitStatus,0);
 
22
    Writeln ('Child exited with status : ',ExitStatus shr 8);
 
23
    end;
 
24
end.