* 1.9.x updates

This commit is contained in:
marco 2004-07-17 22:26:42 +00:00
parent fe840931ad
commit b95908698f
3 changed files with 37 additions and 9 deletions

View File

@ -1 +1,31 @@
:pserver:mazen@cvs.freepascal.org:/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.

View File

@ -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.

View File

@ -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.