ソースを参照

+ Added pause and alarm, now all examples use FPCExample

michael 26 年 前
コミット
b5560c1fbe
1 ファイル変更95 行追加109 行削除
  1. 95 109
      docs/linux.tex

+ 95 - 109
docs/linux.tex

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