瀏覽代碼

* 1.9.x updates

marco 21 年之前
父節點
當前提交
b95908698f
共有 3 個文件被更改,包括 37 次插入9 次删除
  1. 31 1
      docs/linuxex/ex21.pp
  2. 4 4
      docs/linuxex/ex22.pp
  3. 2 4
      docs/linuxex/ex23.pp

+ 31 - 1
docs/linuxex/ex21.pp

@@ -1 +1,31 @@
-:pserver:[email protected]:/FPC/CVS
+Program Example21;
+
+{ Program to demonstrate the Link and UnLink functions. }
+
+Uses BaseUnix;
+
+Var F : Text;
+    S : String;
+begin
+  Assign (F,'test.txt');
+  Rewrite (F);
+  Writeln (F,'This is written to test.txt');
+  Close(f);
+  { new.txt and test.txt are now the same file }
+  if fpLink ('test.txt','new.txt')<>0 then
+    writeln ('Error when linking !');
+  { Removing test.txt still leaves new.txt }
+  If fpUnlink ('test.txt')<>0 then
+    Writeln ('Error when unlinking !');
+  Assign (f,'new.txt');
+  Reset (F);
+  While not EOF(f) do 
+    begin
+    Readln(F,S);
+    Writeln ('> ',s);
+    end;
+ Close (f);
+ { Remove new.txt also }
+ If not FPUnlink ('new.txt')<>0 then
+   Writeln ('Error when unlinking !');
+end.

+ 4 - 4
docs/linuxex/ex22.pp

@@ -2,7 +2,7 @@ Program Example22;
 
 { Program to demonstrate the SymLink and UnLink functions. }
 
-Uses linux;
+Uses baseunix,Unix;
 
 Var F : Text;
     S : String;
@@ -13,11 +13,11 @@ 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 !');
   { Removing test.txt still leaves new.txt
     Pointing now to a non-existent file ! }
-  If not Unlink ('test.txt') then
+  If fpUnlink ('test.txt')<>0 then
     Writeln ('Error when unlinking !');
   Assign (f,'new.txt');
   { This should fail, since the symbolic link
@@ -28,6 +28,6 @@ begin
   If IOResult=0 then
     Writeln ('This shouldn''t happen'); 
  { Now remove new.txt also }
- If not Unlink ('new.txt') then
+ If fpUnlink ('new.txt')<>0 then
    Writeln ('Error when unlinking !');
 end.

+ 2 - 4
docs/linuxex/ex23.pp

@@ -2,7 +2,7 @@ Program Example23;
 
 { Program to demonstrate the Chmod function. }
 
-Uses linux;
+Uses BaseUnix,Unix;
 
 Var F : Text;
 
@@ -13,9 +13,7 @@ begin
   Writeln (f,'#!/bin/sh');
   Writeln (f,'echo Some text for this file');
   Close (F);
-  { Octal() makes the correct number from a
-    number that LOOKS octal }
-  Chmod ('testex21',octal (777)); 
+  fpChmod ('testex21',&777); 
   { File is now executable  }
   execl ('./testex21');    
 end.