Browse Source

+ Added pause and alarm, now all examples use FPCExample

michael 26 years ago
parent
commit
b5560c1fbe
1 changed files with 95 additions and 109 deletions
  1. 95 109
      docs/linux.tex

+ 95 - 109
docs/linux.tex

@@ -19,6 +19,8 @@
 %   Boston, MA 02111-1307, USA. 
 %   Boston, MA 02111-1307, USA. 
 %
 %
 \chapter{The LINUX unit.}
 \chapter{The LINUX unit.}
+\label{ch:linux}
+\FPCexampledir{linuxex}
 This chapter describes the LINUX unit for Free Pascal. The unit was written
 This chapter describes the LINUX unit for Free Pascal. The unit was written
 by Micha\"el van Canneyt. It works only on the Linux operating system.
 by Micha\"el van Canneyt. It works only on the Linux operating system.
 This chapter is divided in 2 sections:
 This chapter is divided in 2 sections:
@@ -375,13 +377,14 @@ the \seep{FLock} call uses the following mode constants :
   LOCK_UN = 8;
   LOCK_UN = 8;
   LOCK_NB = 4;
   LOCK_NB = 4;
 \end{verbatim}
 \end{verbatim}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Functions and procedures
 \section{Functions and procedures}
 \section{Functions and procedures}
+
 \begin{function}{Access}
 \begin{function}{Access}
 \Declaration
 \Declaration
 Function Access (Path : Pathstr; Mode : integer) : Boolean;
 Function Access (Path : Pathstr; Mode : integer) : Boolean;
-
 \Description
 \Description
-
 Tests user's access rights on the specified file. Mode is a mask existing of
 Tests user's access rights on the specified file. Mode is a mask existing of
 one or more of
 one or more of
 \begin{description}
 \begin{description}
@@ -392,7 +395,6 @@ one or more of
 \end{description}
 \end{description}
 The test is done with the real user ID, instead of the effective user ID.
 The test is done with the real user ID, instead of the effective user ID.
 If access is denied, or an error occurred, false is returned.
 If access is denied, or an error occurred, false is returned.
-
 \Errors
 \Errors
  \var{LinuxError} is used to report errors:
  \var{LinuxError} is used to report errors:
 \begin{description}
 \begin{description}
@@ -409,8 +411,25 @@ dangling symbolic link.
 \SeeAlso
 \SeeAlso
 \seef{Chown}, \seef{Chmod}, \seem{Access}{2} 
 \seef{Chown}, \seef{Chmod}, \seem{Access}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex26.pp}}
-\html{\input{linuxex/ex26.tex}}
+
+\FPCexample{ex26}
+
+\begin{function}{Alarm}
+\Declaration
+Function Alarm(Sec : longint) : Longint;
+\Description
+Alarm schedules an alarm signal to be delivered to your process in \var{Sec}
+seconds. When \var{Sec} seconds have elapsed, Linux will send a \var{SIGALRM}
+signal to the current process.  If \var{Sec} is zero, then no new alarm will
+be set. Whatever the value of \var{Sec}, any previous alarm is cancelled.
+
+The function returns the number of seconds till the previously scheduled
+alarm was due to be delivered, or zero if there was none.
+\Errors{None}
+\end{function}
+
+\FPCexample{ex59}
+
 \begin{procedure}{AssignPipe}
 \begin{procedure}{AssignPipe}
 \Declaration
 \Declaration
 Procedure AssignPipe (Pipe\_in, Pipe\_out : Text);
 Procedure AssignPipe (Pipe\_in, Pipe\_out : Text);
@@ -431,8 +450,7 @@ Reading and writing happens through the usual \var{Readln(Pipe\_in,...)} and
 \SeeAlso
 \SeeAlso
 \seep{POpen}, \seef{MkFifo}, \seem{pipe}{2}
 \seep{POpen}, \seef{MkFifo}, \seem{pipe}{2}
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex36.pp}}
-\html{\input{linuxex/ex36.tex}}
+\FPCexample{ex36}
 \begin{procedure}{AssignStream}
 \begin{procedure}{AssignStream}
 \Declaration
 \Declaration
 Procedure AssignStream (StreamIn,StreamOut : Text; Const prog : String);
 Procedure AssignStream (StreamIn,StreamOut : Text; Const prog : String);
@@ -463,8 +481,7 @@ Other errors include the ones by the fork and exec programs
 \SeeAlso
 \SeeAlso
 \seep{AssignPipe}, \seep{POpen},\seem{pipe}{2}
 \seep{AssignPipe}, \seep{POpen},\seem{pipe}{2}
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex38.pp}}
-\html{\input{linuxex/ex38.tex}}
+\FPCexample{ex38}
 \begin{function}{BaseName}
 \begin{function}{BaseName}
 \Declaration
 \Declaration
 Function BaseName (Const Path;Suf : Pathstr) : Pathstr;
 Function BaseName (Const Path;Suf : Pathstr) : Pathstr;
@@ -482,8 +499,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{DirName}, \seef{FExpand}, \seem{Basename}{1}
 \seef{DirName}, \seef{FExpand}, \seem{Basename}{1}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex48.pp}}
-\html{\input{linuxex/ex48.tex}}
+\FPCexample{ex48}
 \begin{procedure}{CFMakeRaw}
 \begin{procedure}{CFMakeRaw}
 \Declaration
 \Declaration
 Procedure CFMakeRaw (var Tios:TermIOS);
 Procedure CFMakeRaw (var Tios:TermIOS);
@@ -558,8 +574,7 @@ symbolic link, i.e. a symbolic link, whose expansion points to itself.
 \SeeAlso
 \SeeAlso
 \seef{Chmod}, \seef{Access}, \seem{Chown}(2)
 \seef{Chmod}, \seef{Access}, \seem{Chown}(2)
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex24.pp}}
-\html{\input{linuxex/ex24.tex}}
+\FPCexample{ex24}
 \begin{function}{Chmod}
 \begin{function}{Chmod}
 \Declaration
 \Declaration
 Function Chmod (Path : Pathstr;NewMode : Longint) : Boolean;
 Function Chmod (Path : Pathstr;NewMode : Longint) : Boolean;
@@ -607,8 +622,7 @@ symbolic link, i.e. a symbolic link, whose expansion points to itself.
 \SeeAlso
 \SeeAlso
 \seef{Chown}, \seef{Access}, \seem{Chmod}(2)
 \seef{Chown}, \seef{Access}, \seem{Chmod}(2)
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex23.pp}}
-\html{\input{linuxex/ex23.tex}}
+\FPCexample{ex23}
 \begin{function}{CloseDir}
 \begin{function}{CloseDir}
 \Declaration
 \Declaration
 Function CloseDir (p:pdir) : integer;
 Function CloseDir (p:pdir) : integer;
@@ -639,8 +653,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{BaseName}, \seef{FExpand}, \seem{Dirname}{1}
 \seef{BaseName}, \seef{FExpand}, \seem{Dirname}{1}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex47.pp}}
-\html{\input{linuxex/ex47.tex}}
+\FPCexample{ex47}
 \begin{procedure}{Dup}
 \begin{procedure}{Dup}
 \Declaration
 \Declaration
 Procedure Dup (Var OldFile, NewFile : Text);
 Procedure Dup (Var OldFile, NewFile : Text);
@@ -665,8 +678,7 @@ fileposition in both files.
 \SeeAlso
 \SeeAlso
 \seep{Dup2}, \seem{Dup}{2} 
 \seep{Dup2}, \seem{Dup}{2} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex31.pp}}
-\html{\input{linuxex/ex31.tex}}
+\FPCexample{ex31}
 \begin{procedure}{Dup2}
 \begin{procedure}{Dup2}
 \Declaration
 \Declaration
 Procedure Dup2 (Var OldFile, NewFile : Text);
 Procedure Dup2 (Var OldFile, NewFile : Text);
@@ -693,8 +705,7 @@ fileposition in both files.
 \SeeAlso
 \SeeAlso
  \seep{Dup}, \seem{Dup2}{2} 
  \seep{Dup}, \seem{Dup2}{2} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex32.pp}}
-\html{\input{linuxex/ex32.tex}}
+\FPCexample{ex32}
 \begin{procedure}{EpochToLocal}
 \begin{procedure}{EpochToLocal}
 \Declaration
 \Declaration
 Procedure EpochToLocal (Epoch : Longint; var Year,Month,Day,Hour,Minute,Second : Word);
 Procedure EpochToLocal (Epoch : Longint; var Year,Month,Day,Hour,Minute,Second : Word);
@@ -709,8 +720,7 @@ None
 \SeeAlso
 \SeeAlso
 \seef{GetEpochTime}, \seef{LocalToEpoch}, \seep{GetTime},\seep{GetDate} 
 \seef{GetEpochTime}, \seef{LocalToEpoch}, \seep{GetTime},\seep{GetDate} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex3.pp}}
-\html{\input{linuxex/ex3.tex}}
+\FPCexample{ex3}
 \begin{procedure}{Execl}
 \begin{procedure}{Execl}
 \Declaration
 \Declaration
 Procedure Execl (Path : pathstr);
 Procedure Execl (Path : pathstr);
@@ -740,8 +750,7 @@ A compononent of the path has no search permission.
 \seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle},
 \seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle},
  \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} 
  \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex10.pp}}
-\html{\input{linuxex/ex10.tex}}
+\FPCexample{ex10}
 \begin{procedure}{Execle}
 \begin{procedure}{Execle}
 \Declaration
 \Declaration
 Procedure Execle (Path : pathstr, Ep : ppchar);
 Procedure Execle (Path : pathstr, Ep : ppchar);
@@ -772,8 +781,7 @@ A compononent of the path has no search permission.
 \seep{Execve}, \seep{Execv}, \seep{Execvp},
 \seep{Execve}, \seep{Execv}, \seep{Execvp},
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} 
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex11.pp}}
-\html{\input{linuxex/ex11.tex}}
+\FPCexample{ex11}
 \begin{procedure}{Execlp}
 \begin{procedure}{Execlp}
 \Declaration
 \Declaration
 Procedure Execlp (Path : pathstr);
 Procedure Execlp (Path : pathstr);
@@ -804,8 +812,7 @@ A compononent of the path has no search permission.
 \seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle},
 \seep{Execve}, \seep{Execv}, \seep{Execvp}, \seep{Execle},
 \seep{Execl}, \seef {Fork}, \seem{execvp}{3} 
 \seep{Execl}, \seef {Fork}, \seem{execvp}{3} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex12.pp}}
-\html{\input{linuxex/ex12.tex}}
+\FPCexample{ex12}
 \begin{procedure}{Execv}
 \begin{procedure}{Execv}
 \Declaration
 \Declaration
 Procedure Execv (Path : pathstr; args : ppchar);
 Procedure Execv (Path : pathstr; args : ppchar);
@@ -837,8 +844,7 @@ A compononent of the path has no search permission.
 \seep{Execve}, \seep{Execvp}, \seep{Execle},
 \seep{Execve}, \seep{Execvp}, \seep{Execle},
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execv}{3} 
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execv}{3} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex8.pp}}
-\html{\input{linuxex/ex8.tex}}
+\FPCexample{ex8}
 \begin{procedure}{Execve}
 \begin{procedure}{Execve}
 \Declaration
 \Declaration
 Procedure Execve (Path : pathstr; args,ep : ppchar);
 Procedure Execve (Path : pathstr; args,ep : ppchar);
@@ -869,8 +875,7 @@ A compononent of the path has no search permission.
 \seep{Execve}, \seep{Execv}, \seep{Execvp} \seep{Execle},
 \seep{Execve}, \seep{Execv}, \seep{Execvp} \seep{Execle},
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execve}{2} 
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execve}{2} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex7.pp}}
-\html{\input{linuxex/ex7.tex}}
+\FPCexample{ex7}
 \begin{procedure}{Execvp}
 \begin{procedure}{Execvp}
 \Declaration
 \Declaration
 Procedure Execvp (Path : pathstr; args : ppchar);
 Procedure Execvp (Path : pathstr; args : ppchar);
@@ -902,8 +907,7 @@ A compononent of the path has no search permission.
 \seep{Execve}, \seep{Execv}, \seep{Execle},
 \seep{Execve}, \seep{Execv}, \seep{Execle},
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} 
 \seep{Execl}, \seep{Execlp}, \seef {Fork}, \seem{execvp}{3} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex9.pp}}
-\html{\input{linuxex/ex9.tex}}
+\FPCexample{ex9}
 
 
 \begin{procedurel}{FD\_ZERO}{FDZero}
 \begin{procedurel}{FD\_ZERO}{FDZero}
 \Declaration
 \Declaration
@@ -1027,8 +1031,7 @@ Errors are returned in LinuxError
 \seef{fdClose}, \seef{fdRead}, \seef{fdWrite},\seef{fdTruncate},
 \seef{fdClose}, \seef{fdRead}, \seef{fdWrite},\seef{fdTruncate},
 \seef{fdFlush}, \seef{fdSeek}
 \seef{fdFlush}, \seef{fdSeek}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex19.pp}}
-\html{\input{linuxex/ex19.tex}}
+\FPCexample{ex19}
 \begin{function}{fdRead}
 \begin{function}{fdRead}
 \Declaration
 \Declaration
 Function fdRead (fd:longint;var buf;size:longint : longint;
 Function fdRead (fd:longint;var buf;size:longint : longint;
@@ -1046,8 +1049,7 @@ Errors are returned in LinuxError.
 \seef{fdOpen}, \seef{fdClose}, \seef{fdWrite},\seef{fdTruncate},
 \seef{fdOpen}, \seef{fdClose}, \seef{fdWrite},\seef{fdTruncate},
 \seef{fdFlush}, \seef{fdSeek}
 \seef{fdFlush}, \seef{fdSeek}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex20.pp}}
-\html{\input{linuxex/ex20.tex}}
+\FPCexample{ex20}
 \begin{function}{fdSeek}
 \begin{function}{fdSeek}
 \Declaration
 \Declaration
 Function fdSeek (fd,Pos,SeekType:longint : longint;
 Function fdSeek (fd,Pos,SeekType:longint : longint;
@@ -1115,8 +1117,7 @@ None
 \SeeAlso
 \SeeAlso
 \seef{BaseName},\seef{DirName} 
 \seef{BaseName},\seef{DirName} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex45.pp}}
-\html{\input{linuxex/ex45.tex}}
+\FPCexample{ex45}
 \begin{procedure}{FLock}
 \begin{procedure}{FLock}
 \Declaration
 \Declaration
 Procedure FLock (Var F; Mode : longint);
 Procedure FLock (Var F; Mode : longint);
@@ -1164,8 +1165,7 @@ failed.
 \SeeAlso
 \SeeAlso
 \seef{FStat}, \seef{LStat}, \seem{statfs}{2}
 \seef{FStat}, \seef{LStat}, \seem{statfs}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex30.pp}}
-\html{\input{linuxex/ex30.tex}}
+\FPCexample{ex30}
 \begin{function}{FSearch}
 \begin{function}{FSearch}
 \Declaration
 \Declaration
 Function FSearch (Path : pathstr;DirList : string) : Pathstr;
 Function FSearch (Path : pathstr;DirList : string) : Pathstr;
@@ -1178,8 +1178,7 @@ An empty string if no such file was found.
 \SeeAlso
 \SeeAlso
 \seef{BaseName}, \seef{DirName}, \seef{FExpand} 
 \seef{BaseName}, \seef{DirName}, \seef{FExpand} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex46.pp}}
-\html{\input{linuxex/ex46.tex}}
+\FPCexample{ex46}
 \begin{function}{FStat}
 \begin{function}{FStat}
 \Declaration
 \Declaration
 Function FStat (Path : Pathstr; Var Info : stat) : Boolean;
 Function FStat (Path : Pathstr; Var Info : stat) : Boolean;
@@ -1200,8 +1199,7 @@ failed.
 \SeeAlso
 \SeeAlso
 \seef{FSStat}, \seef{LStat}, \seem{stat}{2}
 \seef{FSStat}, \seef{LStat}, \seem{stat}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex28.pp}}
-\html{\input{linuxex/ex28.tex}}
+\FPCexample{ex28}
 \begin{function}{Fcntl}
 \begin{function}{Fcntl}
 \Declaration
 \Declaration
 Function Fcntl (Fd :  text, Cmd : Integer) : Integer;
 Function Fcntl (Fd :  text, Cmd : Integer) : Integer;
@@ -1280,8 +1278,7 @@ On error, -1 is returned to the parent, and no child is created.
 \SeeAlso
 \SeeAlso
 \seep{Execve}, \seem{fork}{2}
 \seep{Execve}, \seem{fork}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex14.pp}}
-\html{\input{linuxex/ex14.tex}}
+\FPCexample{ex14}
 \begin{procedure}{GetDate}
 \begin{procedure}{GetDate}
 \Declaration
 \Declaration
 Procedure GetDate  (Var Year, Month, Day : Word) ;
 Procedure GetDate  (Var Year, Month, Day : Word) ;
@@ -1295,8 +1292,7 @@ None
 \SeeAlso
 \SeeAlso
 \seef{GetEpochTime}, \seep{GetTime}, \seep{EpochToLocal} 
 \seef{GetEpochTime}, \seep{GetTime}, \seep{EpochToLocal} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex6.pp}}
-\html{\input{linuxex/ex6.tex}}
+\FPCexample{ex6}
 \begin{function}{GetDomainName}
 \begin{function}{GetDomainName}
 \Declaration
 \Declaration
 Function GetDomainName  : String;
 Function GetDomainName  : String;
@@ -1311,8 +1307,7 @@ None.
 \SeeAlso
 \SeeAlso
  \seef{GetHostName},seem{Getdomainname}{2} 
  \seef{GetHostName},seem{Getdomainname}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex39.pp}}
-\html{\input{linuxex/ex39.tex}}
+\FPCexample{ex39}
 \begin{function}{GetEGid}
 \begin{function}{GetEGid}
 \Declaration
 \Declaration
 Function GetEGid  : Longint;
 Function GetEGid  : Longint;
@@ -1324,8 +1319,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{GetGid}, \seem{getegid}{2} 
 \seef{GetGid}, \seem{getegid}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex18.pp}}
-\html{\input{linuxex/ex18.tex}}
+\FPCexample{ex18}
 \begin{function}{GetEUid}
 \begin{function}{GetEUid}
 \Declaration
 \Declaration
 Function GetEUid  : Longint;
 Function GetEUid  : Longint;
@@ -1337,8 +1331,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{GetEUid}, \seem{geteuid}{2} 
 \seef{GetEUid}, \seem{geteuid}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex17.pp}}
-\html{\input{linuxex/ex17.tex}}
+\FPCexample{ex17}
 \begin{function}{GetEnv}
 \begin{function}{GetEnv}
 \Declaration
 \Declaration
 Function GetEnv (P : String) : PChar;
 Function GetEnv (P : String) : PChar;
@@ -1355,8 +1348,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seem{sh}{1}, \seem{csh}{1} 
 \seem{sh}{1}, \seem{csh}{1} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex41.pp}}
-\html{\input{linuxex/ex41.tex}}
+\FPCexample{ex41}
 \begin{function}{GetEpochTime}
 \begin{function}{GetEpochTime}
 \Declaration
 \Declaration
 Function GetEpochTime  : longint;
 Function GetEpochTime  : longint;
@@ -1371,8 +1363,7 @@ no errors
 \SeeAlso
 \SeeAlso
 \seep{EpochToLocal}, \seep{GetTime}, \seem{time}{2}
 \seep{EpochToLocal}, \seep{GetTime}, \seem{time}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex1.pp}}
-\html{\input{linuxex/ex1.tex}}
+\FPCexample{ex1}
 \begin{function}{GetFS}
 \begin{function}{GetFS}
 \Declaration
 \Declaration
 Function GetFS (Var F : Any File Type) : Longint;
 Function GetFS (Var F : Any File Type) : Longint;
@@ -1386,8 +1377,7 @@ In case the file was not opened, then -1 is returned.
 \SeeAlso
 \SeeAlso
 \seef{Select}
 \seef{Select}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex34.pp}}
-\html{\input{linuxex/ex34.tex}}
+\FPCexample{ex34}
 \begin{function}{GetGid}
 \begin{function}{GetGid}
 \Declaration
 \Declaration
 Function GetGid  : Longint;
 Function GetGid  : Longint;
@@ -1399,8 +1389,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{GetEGid}, \seem{getgid}{2} 
 \seef{GetEGid}, \seem{getgid}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex18.pp}}
-\html{\input{linuxex/ex18.tex}}
+\FPCexample{ex18}
 \begin{function}{GetHostName}
 \begin{function}{GetHostName}
 \Declaration
 \Declaration
 Function GetHostName  : String;
 Function GetHostName  : String;
@@ -1415,8 +1404,7 @@ None.
 \SeeAlso
 \SeeAlso
  \seef{GetDomainName},seem{Gethostname}{2} 
  \seef{GetDomainName},seem{Gethostname}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex40.pp}}
-\html{\input{linuxex/ex40.tex}}
+\FPCexample{ex40}
 \begin{function}{GetPid}
 \begin{function}{GetPid}
 \Declaration
 \Declaration
 Function GetPid  : Longint;
 Function GetPid  : Longint;
@@ -1428,8 +1416,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{GetPPid}, \seem{getpid}{2}
 \seef{GetPPid}, \seem{getpid}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex16.pp}}
-\html{\input{linuxex/ex16.tex}}
+\FPCexample{ex16}
 \begin{function}{GetPPid}
 \begin{function}{GetPPid}
 \Declaration
 \Declaration
 Function GetPPid  : Longint;
 Function GetPPid  : Longint;
@@ -1441,8 +1428,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{GetPid}, \seem{getppid}{2}
 \seef{GetPid}, \seem{getppid}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex16.pp}}
-\html{\input{linuxex/ex16.tex}}
+\FPCexample{ex16}
 \begin{function}{GetPriority}
 \begin{function}{GetPriority}
 \Declaration
 \Declaration
 Function GetPriority (Which,Who : Integer) : Integer;
 Function GetPriority (Which,Who : Integer) : Integer;
@@ -1481,8 +1467,7 @@ None
 \SeeAlso
 \SeeAlso
 \seef{GetEpochTime}, \seep{GetDate}, \seep{EpochToLocal} 
 \seef{GetEpochTime}, \seep{GetDate}, \seep{EpochToLocal} 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex5.pp}}
-\html{\input{linuxex/ex5.tex}}
+\FPCexample{ex5}
 \begin{function}{GetUid}
 \begin{function}{GetUid}
 \Declaration
 \Declaration
 Function GetUid  : Longint;
 Function GetUid  : Longint;
@@ -1494,8 +1479,7 @@ None.
 \SeeAlso
 \SeeAlso
 \seef{GetEUid}, \seem{getuid}{2} 
 \seef{GetEUid}, \seem{getuid}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex17.pp}}
-\html{\input{linuxex/ex17.tex}}
+\FPCexample{ex17}
 \begin{function}{Glob}
 \begin{function}{Glob}
 \Declaration
 \Declaration
 Function Glob (Const Path : Pathstr) : PGlob;
 Function Glob (Const Path : Pathstr) : PGlob;
@@ -1517,8 +1501,7 @@ usual meaning.
 \SeeAlso
 \SeeAlso
 \seep{GlobFree}, \seem{Glob}{3} 
 \seep{GlobFree}, \seem{Glob}{3} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex49.pp}}
-\html{\input{linuxex/ex49.tex}}
+\FPCexample{ex49}
 \begin{procedure}{GlobFree}
 \begin{procedure}{GlobFree}
 \Declaration
 \Declaration
 Procedure GlobFree (Var P : Pglob);
 Procedure GlobFree (Var P : Pglob);
@@ -1553,8 +1536,7 @@ function, that's why we don't list them here
 \SeeAlso
 \SeeAlso
 \seem{ioctl}{2}
 \seem{ioctl}{2}
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex54.pp}}
-\html{\input{linuxex/ex54.tex}}
+\FPCexample{ex54}
 \begin{function}{IOperm}
 \begin{function}{IOperm}
 \Declaration
 \Declaration
 Function IOperm (From,Num : Cadinal; Value : Longint) : boolean;
 Function IOperm (From,Num : Cadinal; Value : Longint) : boolean;
@@ -1676,6 +1658,7 @@ fifo (a named pipe). If so it returns \var{True}.
 \SeeAlso
 \SeeAlso
 ISLNK.
 ISLNK.
 \end{functionl}
 \end{functionl}
+
 \begin{functionl}{S\_ISLNK}{ISLNK}
 \begin{functionl}{S\_ISLNK}{ISLNK}
 \Declaration
 \Declaration
 Function S\_ISLNK (m:integer) : boolean;
 Function S\_ISLNK (m:integer) : boolean;
@@ -1694,9 +1677,10 @@ symbolic link. If so it returns \var{True}
  \seefl{S\_ISSOCK}{ISSOCK}
  \seefl{S\_ISSOCK}{ISSOCK}
 
 
 \SeeAlso
 \SeeAlso
-\lstinputlisting{linuxex/ex53.pp}
 \end{functionl}
 \end{functionl}
-\html{\input{linuxex/ex53.tex}}
+
+\FPCexample{ex53}
+
 \begin{functionl}{S\_ISREG}{ISREG}
 \begin{functionl}{S\_ISREG}{ISREG}
 \Declaration
 \Declaration
 Function S\_ISREG (m:integer) : boolean;
 Function S\_ISREG (m:integer) : boolean;
@@ -1782,8 +1766,7 @@ failed.
 \SeeAlso
 \SeeAlso
 \seef{FStat}, \seef{FSStat}, \seem{stat}{2}
 \seef{FStat}, \seef{FSStat}, \seem{stat}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex29.pp}}
-\html{\input{linuxex/ex29.tex}}
+\FPCexample{ex29}
 \begin{function}{Link}
 \begin{function}{Link}
 \Declaration
 \Declaration
 Function Link (OldPath,NewPath : pathstr) : Boolean;
 Function Link (OldPath,NewPath : pathstr) : Boolean;
@@ -1822,8 +1805,7 @@ entry.
 \SeeAlso
 \SeeAlso
 \seef{SymLink}, \seef{UnLink}, \seem{Link}{2} 
 \seef{SymLink}, \seef{UnLink}, \seem{Link}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex21.pp}}
-\html{\input{linuxex/ex21.tex}}
+\FPCexample{ex21}
 \begin{function}{LocalToEpoch}
 \begin{function}{LocalToEpoch}
 \Declaration
 \Declaration
 Function LocalToEpoch (Year,Month,Day,Hour,Minute,Second : Word) : longint;
 Function LocalToEpoch (Year,Month,Day,Hour,Minute,Second : Word) : longint;
@@ -1838,8 +1820,7 @@ None
 \SeeAlso
 \SeeAlso
 \seef{GetEpochTime}, \seep{EpochToLocal}, \seep{GetTime},\seep{GetDate} 
 \seef{GetEpochTime}, \seep{EpochToLocal}, \seep{GetTime},\seep{GetDate} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex4.pp}}
-\html{\input{linuxex/ex4.tex}}
+\FPCexample{ex4}
 \begin{function}{MkFifo}
 \begin{function}{MkFifo}
 \Declaration
 \Declaration
 Function MkFifo (PathName: String; Mode : Longint) : Boolean;
 Function MkFifo (PathName: String; Mode : Longint) : Boolean;
@@ -1878,8 +1859,7 @@ do a priority increase.
 \SeeAlso
 \SeeAlso
 \seef{GetPriority}, \seef{SetPriority}, \seem{Nice}{2}
 \seef{GetPriority}, \seef{SetPriority}, \seem{Nice}{2}
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex15.pp}}
-\html{\input{linuxex/ex15.tex}}
+\FPCexample{ex15}
 \begin{function}{OpenDir}
 \begin{function}{OpenDir}
 \Declaration
 \Declaration
 Function OpenDir (f:pchar) : pdir;
 Function OpenDir (f:pchar) : pdir;
@@ -1894,8 +1874,23 @@ Errors are returned in LinuxError.
 \seef{CloseDir}, \seef{ReadDir}, \seep{SeekDir}, \seef{TellDir},
 \seef{CloseDir}, \seef{ReadDir}, \seep{SeekDir}, \seef{TellDir},
 \seem{opendir}{3}
 \seem{opendir}{3}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex35.pp}}
-\html{\input{linuxex/ex35.tex}}
+
+\FPCexample{ex35}
+
+\begin{procedure}{pause}
+\Declaration
+Procedure Pause
+\Description
+\var{Pause} pus the processto sleep and waits until the application receives 
+a signal. If a signal handler is installed for the received sigal, the
+handler will be called and after that pause will return control to the
+process.
+\Errors
+None.
+\end{procedure}
+
+For an example, see \seef{Alarm}.
+
 \begin{function}{PClose}
 \begin{function}{PClose}
 \Declaration
 \Declaration
 Function PClose (Var F : FileType) : longint;
 Function PClose (Var F : FileType) : longint;
@@ -1934,8 +1929,7 @@ Execve, Dup and AssignPipe commands.
 \SeeAlso
 \SeeAlso
 \seep{AssignPipe}, \seem{popen}{3}, \seef{PClose}
 \seep{AssignPipe}, \seem{popen}{3}, \seef{PClose}
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex37.pp}}
-\html{\input{linuxex/ex37.tex}}
+\FPCexample{ex37}
 \begin{function}{ReadDir}
 \begin{function}{ReadDir}
 \Declaration
 \Declaration
 Function ReadDir (p:pdir) : pdirent;
 Function ReadDir (p:pdir) : pdirent;
@@ -2020,8 +2014,7 @@ On error, the function returns -1, and Errors are reported in LinuxError :
 \seepl{FD\_Set}{FDSet}, 
 \seepl{FD\_Set}{FDSet}, 
 \seefl{FD\_IsSet}{FDIsSet}
 \seefl{FD\_IsSet}{FDIsSet}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex33.pp}}
-\html{\input{linuxex/ex33.tex}}
+\FPCexample{ex33}
 \begin{function}{SelectText}
 \begin{function}{SelectText}
 \Declaration
 \Declaration
 Function SelectText ( var T : Text; TimeOut :PTime) : Longint;
 Function SelectText ( var T : Text; TimeOut :PTime) : Longint;
@@ -2083,8 +2076,7 @@ Errors are reported in LinuxError.
 \SeeAlso
 \SeeAlso
 \seep{POpen}, \seef{Fork}, \seep{Execve}, \seem{system}{3}
 \seep{POpen}, \seef{Fork}, \seep{Execve}, \seem{system}{3}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex56.pp}}
-\html{\input{linuxex/ex56.tex}}
+\FPCexample{ex56}
 \begin{procedure}{SigAction}
 \begin{procedure}{SigAction}
 \Declaration
 \Declaration
 Procedure SigAction (Signum : Integer; Var Act,OldAct : PSigActionRec);
 Procedure SigAction (Signum : Integer; Var Act,OldAct : PSigActionRec);
@@ -2127,8 +2119,7 @@ from within its own signal handler.
 \seem{Sigaction}{2}
 \seem{Sigaction}{2}
 
 
 \end{procedure}
 \end{procedure}
-\latex{\lstinputlisting{linuxex/ex57.pp}}
-\html{\input{linuxex/ex57.tex}}
+\FPCexample{ex57}
 \begin{function}{SigPending}
 \begin{function}{SigPending}
 \Declaration
 \Declaration
 Function SigPending  : SigSet;
 Function SigPending  : SigSet;
@@ -2206,8 +2197,7 @@ The return value for Signal is the old signal handler, or nil on error.
 \SeeAlso
 \SeeAlso
 \seep{SigAction},\seef{Kill}, \seem{Signal}{2} 
 \seep{SigAction},\seef{Kill}, \seem{Signal}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex58.pp}}
-\html{\input{linuxex/ex58.tex}}
+\FPCexample{ex58}
 \begin{function}{SymLink}
 \begin{function}{SymLink}
 \Declaration
 \Declaration
 Function SymLink (OldPath,NewPath : pathstr) : Boolean;
 Function SymLink (OldPath,NewPath : pathstr) : Boolean;
@@ -2246,8 +2236,7 @@ entry.
 \SeeAlso
 \SeeAlso
 \seef{Link}, \seef{UnLink}, \seem{Symlink}{2} 
 \seef{Link}, \seef{UnLink}, \seem{Symlink}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex22.pp}}
-\html{\input{linuxex/ex22.tex}}
+\FPCexample{ex22}
 \begin{function}{TCDrain}
 \begin{function}{TCDrain}
 \Declaration
 \Declaration
 Function TCDrain (Fd:longint) : Boolean;
 Function TCDrain (Fd:longint) : Boolean;
@@ -2326,8 +2315,7 @@ Errors are reported in LinuxError
 \SeeAlso
 \SeeAlso
 \seef{TCSetAttr}, \seem{termios}{2} 
 \seef{TCSetAttr}, \seem{termios}{2} 
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex55.pp}}
-\html{\input{linuxex/ex55.tex}}
+\FPCexample{ex55}
 \begin{function}{TCGetPGrp}
 \begin{function}{TCGetPGrp}
 \Declaration
 \Declaration
 Function TCGetPGrp (Fd:longint;var Id:longint) : boolean;
 Function TCGetPGrp (Fd:longint;var Id:longint) : boolean;
@@ -2446,8 +2434,7 @@ None
 \SeeAlso
 \SeeAlso
 \seef{Chmod}, \seem{Umask}{2}
 \seef{Chmod}, \seem{Umask}{2}
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex27.pp}}
-\html{\input{linuxex/ex27.tex}}
+\FPCexample{ex27}
 \begin{procedure}{Uname}
 \begin{procedure}{Uname}
 \Declaration
 \Declaration
 Procedure Uname (var unamerec:utsname);
 Procedure Uname (var unamerec:utsname);
@@ -2519,8 +2506,7 @@ Other errors may occur, but aren't documented.
 \SeeAlso
 \SeeAlso
 \seef{GetEpochTime}, \seef{Chown}, \seef{Access}, \seem{utime}(2)
 \seef{GetEpochTime}, \seef{Chown}, \seef{Access}, \seem{utime}(2)
 \end{function}
 \end{function}
-\latex{\lstinputlisting{linuxex/ex25.pp}}
-\html{\input{linuxex/ex25.tex}}
+\FPCexample{ex25}
 \begin{function}{WaitPid}
 \begin{function}{WaitPid}
 \Declaration
 \Declaration
 Function WaitPid (Pid : longint; Status : pointer; Options : Integer) : Longint;
 Function WaitPid (Pid : longint; Status : pointer; Options : Integer) : Longint;