mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 23:42:34 +02:00
* 1.9.x fixes
This commit is contained in:
parent
f498e954a5
commit
7dcad07b60
@ -2,7 +2,7 @@ Program Example39;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetDomainName function. }
|
{ Program to demonstrate the GetDomainName function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses Unix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('Domain name of this machine is : ',GetDomainName);
|
Writeln ('Domain name of this machine is : ',GetDomainName);
|
||||||
|
@ -2,7 +2,7 @@ Program Example40;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetHostName function. }
|
{ Program to demonstrate the GetHostName function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses unix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('Name of this machine is : ',GetHostName);
|
Writeln ('Name of this machine is : ',GetHostName);
|
||||||
|
@ -2,8 +2,8 @@ Program Example41;
|
|||||||
|
|
||||||
{ Program to demonstrate the GetEnv function. }
|
{ Program to demonstrate the GetEnv function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('Path is : ',Getenv('PATH'));
|
Writeln ('Path is : ',fpGetenv('PATH'));
|
||||||
end.
|
end.
|
||||||
|
@ -2,11 +2,14 @@ Program Example42;
|
|||||||
|
|
||||||
{ Program to demonstrate the SysInfo function. }
|
{ Program to demonstrate the SysInfo function. }
|
||||||
|
|
||||||
|
{$ifdef Linux} // is Linux specific.
|
||||||
Uses linux;
|
Uses linux;
|
||||||
|
|
||||||
Var Info : TSysinfo;
|
Var Info : TSysinfo;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$ifdef Linux}
|
||||||
If SysInfo (Info) then
|
If SysInfo (Info) then
|
||||||
With info do
|
With info do
|
||||||
begin
|
begin
|
||||||
@ -19,4 +22,5 @@ begin
|
|||||||
Writeln ('Free swap : ',FreeSwap Div 1024,'Kb.');
|
Writeln ('Free swap : ',FreeSwap Div 1024,'Kb.');
|
||||||
Writeln ('No. Processes : ',procs);
|
Writeln ('No. Processes : ',procs);
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
end.
|
end.
|
||||||
|
@ -2,12 +2,12 @@ Program Example43;
|
|||||||
|
|
||||||
{ Program to demonstrate the Uname function. }
|
{ Program to demonstrate the Uname function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix;
|
||||||
|
|
||||||
Var UN : utsname;
|
Var UN : utsname;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Uname (UN) then
|
if fpUname (UN)=0 then
|
||||||
With UN do
|
With UN do
|
||||||
begin
|
begin
|
||||||
Writeln ('Name : ',pchar(@sysname[0]));
|
Writeln ('Name : ',pchar(@sysname[0]));
|
||||||
@ -15,6 +15,8 @@ begin
|
|||||||
Writeln ('release : ',pchar(@Release[0]));
|
Writeln ('release : ',pchar(@Release[0]));
|
||||||
Writeln ('Version : ',pchar(@Version[0]));
|
Writeln ('Version : ',pchar(@Version[0]));
|
||||||
Writeln ('Machine : ',pchar(@Machine[0]));
|
Writeln ('Machine : ',pchar(@Machine[0]));
|
||||||
|
{$ifdef Linux} // linuxism
|
||||||
Writeln ('Domainname : ',pchar(@domainname[0]));
|
Writeln ('Domainname : ',pchar(@domainname[0]));
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
end.
|
end.
|
||||||
|
@ -2,8 +2,8 @@ Program Example44;
|
|||||||
|
|
||||||
{ Program to demonstrate the Octal function. }
|
{ Program to demonstrate the Octal function. }
|
||||||
|
|
||||||
Uses linux;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('Octal(666) : ',octal(666));
|
// Writeln ('Octal(666) : ',octal(666));
|
||||||
|
Writeln (' &666 : ',&666); // 1.9.x+ functionality, octal is not necessary anymore
|
||||||
end.
|
end.
|
||||||
|
@ -2,7 +2,7 @@ Program Example45;
|
|||||||
|
|
||||||
{ Program to demonstrate the FExpand function. }
|
{ Program to demonstrate the FExpand function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses Unix;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('This program is in : ',FExpand(Paramstr(0)));
|
Writeln ('This program is in : ',FExpand(Paramstr(0)));
|
||||||
|
@ -2,8 +2,8 @@ Program Example46;
|
|||||||
|
|
||||||
{ Program to demonstrate the FSearch function. }
|
{ Program to demonstrate the FSearch function. }
|
||||||
|
|
||||||
Uses linux,strings;
|
Uses BaseUnix, Unix, Strings;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Writeln ('ls is in : ',FSearch ('ls',strpas(Getenv('PATH'))));
|
Writeln ('ls is in : ',FSearch ('ls',strpas(fpGetenv('PATH'))));
|
||||||
end.
|
end.
|
||||||
|
@ -2,7 +2,7 @@ Program Example47;
|
|||||||
|
|
||||||
{ Program to demonstrate the DirName function. }
|
{ Program to demonstrate the DirName function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses Unix,UnixUtil;
|
||||||
|
|
||||||
Var S : String;
|
Var S : String;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ Program Example48;
|
|||||||
|
|
||||||
{ Program to demonstrate the BaseName function. }
|
{ Program to demonstrate the BaseName function. }
|
||||||
|
|
||||||
Uses linux;
|
Uses Unix,UnixUtil;
|
||||||
|
|
||||||
Var S : String;
|
Var S : String;
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@ Program Example49;
|
|||||||
|
|
||||||
{ Program to demonstrate the Glob and GlobFree functions. }
|
{ Program to demonstrate the Glob and GlobFree functions. }
|
||||||
|
|
||||||
Uses linux;
|
Uses BaseUnix,Unix;
|
||||||
|
|
||||||
Var G1,G2 : PGlob;
|
Var G1,G2 : PGlob;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
G1:=Glob ('*');
|
G1:=Glob ('*');
|
||||||
if LinuxError=0 then
|
if fpgeterrno=0 then
|
||||||
begin
|
begin
|
||||||
G2:=G1;
|
G2:=G1;
|
||||||
Writeln ('Files in this directory : ');
|
Writeln ('Files in this directory : ');
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
Program Example51;
|
Program Example51;
|
||||||
|
|
||||||
{ Program to demonstrate the StringToPPChar function. }
|
{ Program to demonstrate the StringToPPChar function.
|
||||||
|
This function is pretty obsolete }
|
||||||
|
|
||||||
Uses linux;
|
Uses UnixUtil;
|
||||||
|
|
||||||
var P : PPChar;
|
var P : PPChar;
|
||||||
S : String;
|
S : String;
|
||||||
begin
|
begin
|
||||||
S:='/bin/ls -l -F';
|
S:='/bin/ls -l -F';
|
||||||
P:=StringToPPChar(S);
|
P:=StringToPPChar(S,0);
|
||||||
Writeln ('Name : ',p^); inc(longint(p),4);
|
Writeln ('Name : ',p^); inc(longint(p),4);
|
||||||
writeln ('Option 1 : ',p^); inc(longint(p),4);
|
writeln ('Option 1 : ',p^); inc(longint(p),4);
|
||||||
writeln ('Option 2 : ',p^);
|
writeln ('Option 2 : ',p^);
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user