Browse Source

* more 1.9.x fixes

marco 21 years ago
parent
commit
ab913d0d17

+ 9 - 8
docs/linuxex/ex57.pp

@@ -8,12 +8,12 @@ replace pid with the real pid of this program.
 You can get this pid by running 'ps'.
 }
 
-uses Linux;
+uses BaseUnix;
 
 Var
    oa,na : PSigActionRec;
    
-Procedure DoSig(sig : Longint);cdecl;
+Procedure DoSig(sig : cint);cdecl;
 
 begin
    writeln('Receiving signal: ',sig);
@@ -22,14 +22,15 @@ end;
 begin
    new(na);
    new(oa);
-   na^.Handler.sh:=@DoSig;
-   na^.Sa_Mask:=0;
+   na^.sa_Handler:=TSigaction(@DoSig);
+   fillchar(na^.Sa_Mask,sizeof(na^.sa_mask),#0);
    na^.Sa_Flags:=0;
-   na^.Sa_Restorer:=Nil;
-   SigAction(SigUsr1,na,oa);
-   if LinuxError<>0 then
+   {$ifdef Linux}		// Linux specific
+     na^.Sa_Restorer:=Nil;
+   {$endif}
+   if fpSigAction(SigUsr1,na,oa)<>0 then
      begin
-     writeln('Error: ',linuxerror,'.');
+     writeln('Error: ',fpgeterrno,'.');
      halt(1);
      end;
    Writeln ('Send USR1 signal or press <ENTER> to exit'); 

+ 4 - 5
docs/linuxex/ex58.pp

@@ -8,19 +8,18 @@ replace pid with the real pid of this program.
 You can get this pid by running 'ps'.
 }
 
-uses Linux;
+uses BaseUnix;
 
-Procedure DoSig(sig : Longint);cdecl;
+Procedure DoSig(sig : cint);cdecl;
 
 begin
    writeln('Receiving signal: ',sig);
 end; 
 
 begin
-   SigNal(SigUsr1,@DoSig);
-   if LinuxError<>0 then
+   if fpSignal(SigUsr1,SignalHandler(@DoSig))=signalhandler(SIG_ERR) then
      begin
-     writeln('Error: ',linuxerror,'.');
+     writeln('Error: ',fpGetErrno,'.');
      halt(1);
      end;
    Writeln ('Send USR1 signal or press <ENTER> to exit'); 

+ 5 - 5
docs/linuxex/ex59.pp

@@ -2,9 +2,9 @@ Program Example59;
 
 { Program to demonstrate the Alarm function. }
 
-Uses linux;
+Uses BaseUnix;
 
-Procedure AlarmHandler(Sig : longint);cdecl;
+Procedure AlarmHandler(Sig : cint);cdecl;
 
 begin
   Writeln ('Got to alarm handler');
@@ -12,10 +12,10 @@ end;
 
 begin
   Writeln('Setting alarm handler');
-  Signal(SIGALRM,@AlarmHandler);
+  fpSignal(SIGALRM,SignalHandler(@AlarmHandler));
   Writeln ('Scheduling Alarm in 10 seconds');
-  Alarm(10);
+  fpAlarm(10);
   Writeln ('Pausing');
-  Pause;
+  fpPause;
   Writeln ('Pause returned');
 end.

+ 1 - 1
docs/linuxex/ex60.pp

@@ -2,7 +2,7 @@ Program Example6;
 
 { Program to demonstrate the GetDateTime function. }
 
-Uses linux;
+Uses Unix;
 
 Var Year, Month, Day, Hour, min, sec : Word;
 

+ 3 - 1
docs/linuxex/ex61.pp

@@ -2,7 +2,9 @@ Program ex61;
 
 { Example program to demonstrate the CreateShellArgV function }
 
-uses linux;
+// note: CreateShellArgV is reasonbly obsolete in 1.9.x due to  the new fpexec functions
+
+uses Unix;
 
 Var
   S: String;

+ 5 - 5
docs/linuxex/ex62.pp

@@ -2,7 +2,7 @@ Program Example62;
 
 { Program to demonstrate the ReadLink function. }
 
-Uses linux;
+Uses BaseUnix,Unix;
 
 Var F : Text;
     S : String;
@@ -13,16 +13,16 @@ begin
   Writeln (F,'This is written to test.txt');
   Close(f);
   { new.txt and test.txt are now the same file }
-  if not SymLink ('test.txt','new.txt') then
+  if fpSymLink ('test.txt','new.txt')<>0 then
     writeln ('Error when symlinking !');
-  S:=ReadLink('new.txt');
+  S:=fpReadLink('new.txt');
   If S='' then 
     Writeln ('Error reading link !')
   Else   
     Writeln ('Link points to : ',S);
  { Now remove links }
- If not Unlink ('new.txt') then
+ If fpUnlink ('new.txt')<>0 then
    Writeln ('Error when unlinking !');
- If not Unlink ('test.txt') then
+ If fpUnlink ('test.txt')<>0 then
    Writeln ('Error when unlinking !');
 end.

+ 2 - 2
docs/linuxex/ex63.pp

@@ -2,8 +2,8 @@ Program Example63;
 
 { Program to demonstrate the FRename function. }
 
-Uses Linux;
+Uses BaseUnix;
 
 begin
-  FRename (paramstr(1),paramstr(2));
+  FpRename (paramstr(1),paramstr(2));
 end.

+ 6 - 1
docs/linuxex/ex64.pp

@@ -1,7 +1,9 @@
 program Example64;
 
-{ Example to demonstrate the SysInfo function }
+{ Example to demonstrate the SysInfo function.
+  Sysinfo is Linux-only. }
 
+{$ifdef Linux}
 Uses Linux;
 
 Function Mb(L : Longint) : longint;
@@ -12,8 +14,10 @@ end;
    
 Var Info : TSysInfo;
     D,M,Secs,H : longint;
+{$endif}
 
 begin
+  {$ifdef Linux}
   If Not SysInfo(Info) then 
     Halt(1);
   With Info do
@@ -33,4 +37,5 @@ begin
     Writeln('Total Swap : ',Mb(totalswap),'Mb.');
     Writeln('Free Swap  : ',Mb(freeswap),'Mb.');
     end;
+  {$endif}
 end.

+ 8 - 6
docs/linuxex/ex65.pp

@@ -2,7 +2,7 @@ Program example64;
 
 { Program to demonstrate the SigRaise function.}
 
-uses Linux;
+uses Unix,BaseUnix;
 
 Var
    oa,na : PSigActionRec;
@@ -16,14 +16,16 @@ end;
 begin
    new(na);
    new(oa);
-   na^.handler.sh:=@DoSig;
-   na^.Sa_Mask:=0;
+   na^.sa_handler:=TSigaction(@DoSig);
+   fillchar(na^.Sa_Mask,sizeof(na^.Sa_Mask),#0);
    na^.Sa_Flags:=0;
+   {$ifdef Linux}
+   // this member is linux only, and afaik even there arcane 	
    na^.Sa_Restorer:=Nil;
-   SigAction(SigUsr1,na,oa);
-   if LinuxError<>0 then
+   {$endif}
+   if fpSigAction(SigUsr1,na,oa)<>0 then
      begin
-     writeln('Error: ',linuxerror,'.');
+     writeln('Error: ',fpgeterrno);
      halt(1);
      end;
    Writeln('Sending USR1 (',sigusr1,') signal to self.');