From 5f8f040fdc761963e1222d2a728f01a6c02bf01e Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 18 Jul 2004 11:04:29 +0000 Subject: [PATCH] * 1.9.x fixes --- docs/linuxex/ex33.pp | 16 ++++++++-------- docs/linuxex/ex34.pp | 6 +++--- docs/linuxex/ex35.pp | 30 +++++++++++++++--------------- docs/linuxex/ex36.pp | 6 +++--- docs/linuxex/ex37.pp | 8 ++++---- docs/linuxex/ex38.pp | 4 ++-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/linuxex/ex33.pp b/docs/linuxex/ex33.pp index 4c9e3f9da4..90842cf879 100644 --- a/docs/linuxex/ex33.pp +++ b/docs/linuxex/ex33.pp @@ -2,22 +2,22 @@ Program Example33; { Program to demonstrate the Select function. } -Uses linux; +Uses BaseUnix; -Var FDS : FDSet; +Var FDS : sigset_t; begin - FD_Zero (FDS); - FD_Set (0,FDS); + fpsigemptyset (FDS); + fpsigaddset (FDS,0); Writeln ('Press the to continue the program.'); { Wait until File descriptor 0 (=Input) changes } - Select (1,@FDS,nil,nil,nil); + fpSelect (1,@FDS,nil,nil,nil); { Get rid of in buffer } readln; Writeln ('Press key in less than 2 seconds...'); - FD_Zero (FDS); - FD_Set (0,FDS); - if Select (1,@FDS,nil,nil,2000)>0 then + fpsigemptyset (FDS); + fpsigaddset (FDS,0); + if fpSelect (1,@FDS,nil,nil,2000)>0 then Writeln ('Thank you !') { FD_ISSET(0,FDS) would be true here. } else diff --git a/docs/linuxex/ex34.pp b/docs/linuxex/ex34.pp index e904d77e9c..2c28edaef0 100644 --- a/docs/linuxex/ex34.pp +++ b/docs/linuxex/ex34.pp @@ -2,7 +2,7 @@ Program Example33; { Program to demonstrate the SelectText function. } -Uses linux; +Uses Unix; Var tv : TimeVal; @@ -13,8 +13,8 @@ begin { Get rid of in buffer } readln; Writeln ('Press key in less than 2 seconds...'); - tv.sec:=2; - tv.usec:=0; + tv.tv_sec:=2; + tv.tv_sec:=0; if SelectText (Input,@tv)>0 then Writeln ('Thank you !') else diff --git a/docs/linuxex/ex35.pp b/docs/linuxex/ex35.pp index 18baca96e8..cf1013ed6b 100644 --- a/docs/linuxex/ex35.pp +++ b/docs/linuxex/ex35.pp @@ -3,25 +3,25 @@ Program Example35; { Program to demonstrate the OpenDir,ReadDir, SeekDir and TellDir functions. } -Uses linux; +Uses BaseUnix; Var TheDir : PDir; ADirent : PDirent; Entry : Longint; begin - TheDir:=OpenDir('./.'); + TheDir:=fpOpenDir('./.'); Repeat - Entry:=TellDir(TheDir); - ADirent:=ReadDir (TheDir); +// Entry:=fpTellDir(TheDir); + ADirent:=fpReadDir (TheDir^); If ADirent<>Nil then With ADirent^ do begin Writeln ('Entry No : ',Entry); - Writeln ('Inode : ',ino); - Writeln ('Offset : ',off); - Writeln ('Reclen : ',reclen); - Writeln ('Name : ',pchar(@name[0])); + Writeln ('Inode : ',d_fileno); +// Writeln ('Offset : ',d_off); + Writeln ('Reclen : ',d_reclen); + Writeln ('Name : ',pchar(@d_name[0])); end; Until ADirent=Nil; Repeat @@ -29,18 +29,18 @@ begin ReadLn (Entry); If Entry<>-1 then begin - SeekDir (TheDir,Entry); - ADirent:=ReadDir (TheDir); +// fpSeekDir (TheDir,Entry); // not implemented for various platforms + ADirent:=fpReadDir (TheDir^); If ADirent<>Nil then With ADirent^ do begin Writeln ('Entry No : ',Entry); - Writeln ('Inode : ',ino); - Writeln ('Offset : ',off); - Writeln ('Reclen : ',reclen); - Writeln ('Name : ',pchar(@name[0])); + Writeln ('Inode : ',d_fileno); +// Writeln ('Offset : ',off); + Writeln ('Reclen : ',d_reclen); + Writeln ('Name : ',pchar(@d_name[0])); end; end; Until Entry=-1; - CloseDir (TheDir); + fpCloseDir (TheDir^); end. diff --git a/docs/linuxex/ex36.pp b/docs/linuxex/ex36.pp index eb2217af7e..80c528ec49 100644 --- a/docs/linuxex/ex36.pp +++ b/docs/linuxex/ex36.pp @@ -2,15 +2,15 @@ Program Example36; { Program to demonstrate the AssignPipe function. } -Uses linux; +Uses BaseUnix,Unix; Var pipi,pipo : Text; s : String; begin Writeln ('Assigning Pipes.'); - If Not assignpipe(pipi,pipo) then - Writeln('Error assigning pipes !',LinuxError); + If assignpipe(pipi,pipo)<>0 then + Writeln('Error assigning pipes !',fpgeterrno); Writeln ('Writing to pipe, and flushing.'); Writeln (pipo,'This is a textstring');close(pipo); Writeln ('Reading from pipe.'); diff --git a/docs/linuxex/ex37.pp b/docs/linuxex/ex37.pp index 9263aa7d5b..4e3fa056ce 100644 --- a/docs/linuxex/ex37.pp +++ b/docs/linuxex/ex37.pp @@ -2,7 +2,7 @@ Program Example37; { Program to demonstrate the Popen function. } -uses linux; +uses BaseUnix,Unix; var f : text; i : longint; @@ -19,10 +19,10 @@ begin writeln (f,'exit 2'); writeln (f); close (f); - chmod ('test21a',octal (755)); + fpchmod ('test21a',&755); popen (f,'./test21a arg1 arg2','W'); - if linuxerror<>0 then - writeln ('error from POpen : Linuxerror : ', Linuxerror); + if fpgeterrno<>0 then + writeln ('error from POpen : errno : ', fpgeterrno); for i:=1 to 10 do writeln (f,'This is written to the pipe, and should appear on stdout.'); Flush(f); diff --git a/docs/linuxex/ex38.pp b/docs/linuxex/ex38.pp index 09b990d55b..627cf15668 100644 --- a/docs/linuxex/ex38.pp +++ b/docs/linuxex/ex38.pp @@ -2,7 +2,7 @@ Program Example38; { Program to demonstrate the AssignStream function. } -Uses linux; +Uses BaseUnix,Unix; Var Si,So : Text; S : String; @@ -13,7 +13,7 @@ begin begin Writeln ('Calling son'); Assignstream (Si,So,'./ex38 -son'); - if linuxerror<>0 then + if fpgeterrno<>0 then begin writeln ('AssignStream failed !'); halt(1);