diff --git a/docs/linuxex/ex66.pp b/docs/linuxex/ex66.pp index bb56002e5f..337c8ffddf 100644 --- a/docs/linuxex/ex66.pp +++ b/docs/linuxex/ex66.pp @@ -2,36 +2,32 @@ Program Example66; { Program to demonstrate the MMap function. } -Uses linux; +Uses BaseUnix,Unix; -Var S : String; - fd,Len : Longint; - args : tmmapargs; - P : PChar; +Var S : String; + fd : cint; + Len : longint; +// args : tmmapargs; + P : PChar; begin - S:='This is a string'#0; + s:='This is the string'; Len:=Length(S); - fd:=fdOpen('testfile.txt',Open_wrOnly or open_creat); + fd:=fpOpen('testfile.txt',O_wrOnly or o_creat); If fd=-1 then Halt(1); - If fdWrite(fd,S[1],Len)=-1 then + If fpWrite(fd,S[1],Len)=-1 then Halt(2); - fdClose(fd); - fdOpen('testfile.txt',Open_rdOnly); + fpClose(fd); + fd:=fpOpen('testfile.txt',O_rdOnly); if fd=-1 then Halt(3); - args.address:=0; - args.offset:=0; - args.size:=Len+1; - args.fd:=Fd; - args.flags:=MAP_PRIVATE; - args.prot:=PROT_READ or PROT_WRITE; - P:=Pchar(mmap(args)); + P:=Pchar(fpmmap(nil,len+1 ,PROT_READ or PROT_WRITE,MAP_PRIVATE,fd,0)); + If longint(P)=-1 then Halt(4); Writeln('Read in memory :',P); - fdclose(fd); - if Not MUnMap(P,Len) Then - Halt(LinuxError); + fpclose(fd); + if fpMUnMap(P,Len)<>0 Then + Halt(fpgeterrno); end. diff --git a/docs/linuxex/ex67.pp b/docs/linuxex/ex67.pp index e157c53f81..826819e7c4 100644 --- a/docs/linuxex/ex67.pp +++ b/docs/linuxex/ex67.pp @@ -1,6 +1,6 @@ Program Example67; -uses Linux; +uses UnixUtil; { Program to demonstrate the FSplit function. } diff --git a/docs/linuxex/ex68.pp b/docs/linuxex/ex68.pp index dcd29b76cf..cd4e3d7517 100644 --- a/docs/linuxex/ex68.pp +++ b/docs/linuxex/ex68.pp @@ -2,10 +2,8 @@ Program Example68; { Program to demonstrate the Octal function. } -Uses linux; - begin - Writeln('Mode 777 : ', Octal(777)); - Writeln('Mode 644 : ', Octal(644)); - Writeln('Mode 755 : ', Octal(755)); + Writeln('Mode 777 : ', &777); + Writeln('Mode 644 : ', &544); + Writeln('Mode 755 : ', &755); end. diff --git a/docs/linuxex/ex69.pp b/docs/linuxex/ex69.pp index 8c9c18b343..2346f8ae98 100644 --- a/docs/linuxex/ex69.pp +++ b/docs/linuxex/ex69.pp @@ -2,7 +2,7 @@ Program Example69; { Program to demonstrate the FNMatch function. } -Uses linux; +Uses unixutil; Procedure TestMatch(Pattern,Name : String); diff --git a/docs/linuxex/ex70.pp b/docs/linuxex/ex70.pp index 3c896dd6dd..9ff4bc794f 100644 --- a/docs/linuxex/ex70.pp +++ b/docs/linuxex/ex70.pp @@ -2,7 +2,7 @@ Program Example70; { Program to demonstrate the StringToPPchar function. } -Uses linux; +Uses UnixUtil; Var S : String; P : PPChar; @@ -11,7 +11,7 @@ Var S : String; begin // remark whitespace at end. S:='This is a string with words. '; - P:=StringToPPChar(S); + P:=StringToPPChar(S,0); I:=0; While P[i]<>Nil do begin diff --git a/docs/linuxex/ex71.pp b/docs/linuxex/ex71.pp index 0b1d62235c..b4313e218f 100644 --- a/docs/linuxex/ex71.pp +++ b/docs/linuxex/ex71.pp @@ -1,5 +1,8 @@ program TestC{lone}; +{$ifdef Linux} +// close is very Linux specific. 1.9.x threading is done via pthreads. + uses Linux, Errors, crt; @@ -68,4 +71,7 @@ begin end; end; FreeMem( theStack, StackSze ); +{$else} +begin +{$endif} end. \ No newline at end of file diff --git a/docs/linuxex/ex72.pp b/docs/linuxex/ex72.pp index ef3c0c3a33..a0d357e65e 100644 --- a/docs/linuxex/ex72.pp +++ b/docs/linuxex/ex72.pp @@ -2,7 +2,7 @@ program example72; { Program to demonstrate the NanoSleep function. } -uses Linux; +uses BaseUnix; Var Req,Rem : TimeSpec; @@ -16,7 +16,7 @@ begin end; Write('NanoSleep returned : '); Flush(Output); - Res:=(NanoSleep(Req,rem); + Res:=(fpNanoSleep(@Req,@rem)); Writeln(res); If (res<>0) then With rem do