mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 12:39:38 +01:00 
			
		
		
		
	* more 1.9.x fixes
This commit is contained in:
		
							parent
							
								
									7dcad07b60
								
							
						
					
					
						commit
						e35a3f8c65
					
				@ -1,11 +1,12 @@
 | 
			
		||||
Program Example52;
 | 
			
		||||
 | 
			
		||||
{ Program to demonstrate the GetFS function. }
 | 
			
		||||
{ Program to demonstrate the GetFileHandle (was : GetFS) function.
 | 
			
		||||
  In 1.9.x it has been generalised over all platforms }
 | 
			
		||||
 | 
			
		||||
Uses linux;
 | 
			
		||||
Uses SysUtils;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  Writeln ('File descriptor of input  ',getfs(input));
 | 
			
		||||
  Writeln ('File descriptor of output ',getfs(output));
 | 
			
		||||
  Writeln ('File descriptor of stderr ',getfs(stderr));
 | 
			
		||||
  Writeln ('File descriptor of input  ',getFileHandle(input));
 | 
			
		||||
  Writeln ('File descriptor of output ',getFileHandle(output));
 | 
			
		||||
  Writeln ('File descriptor of stderr ',getFileHandle(stderr));
 | 
			
		||||
end.
 | 
			
		||||
 | 
			
		||||
@ -2,26 +2,26 @@ Program Example53;
 | 
			
		||||
 | 
			
		||||
{ Program to demonstrate the S_ISLNK function. }
 | 
			
		||||
 | 
			
		||||
Uses linux;
 | 
			
		||||
Uses BaseUnix,Unix;
 | 
			
		||||
 | 
			
		||||
Var Info : Stat;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  if LStat (paramstr(1),info) then
 | 
			
		||||
  if fpLStat (paramstr(1),@info)=0 then
 | 
			
		||||
    begin
 | 
			
		||||
    if S_ISLNK(info.mode) then 
 | 
			
		||||
    if fpS_ISLNK(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a link');
 | 
			
		||||
    if S_ISREG(info.mode) then 
 | 
			
		||||
    if fpS_ISREG(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a regular file');
 | 
			
		||||
    if S_ISDIR(info.mode) then 
 | 
			
		||||
    if fpS_ISDIR(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a directory');
 | 
			
		||||
    if S_ISCHR(info.mode) then 
 | 
			
		||||
    if fpS_ISCHR(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a character device file');
 | 
			
		||||
    if S_ISBLK(info.mode) then 
 | 
			
		||||
    if fpS_ISBLK(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a block device file');
 | 
			
		||||
    if S_ISFIFO(info.mode) then 
 | 
			
		||||
    if fpS_ISFIFO(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a named pipe (FIFO)');
 | 
			
		||||
    if S_ISSOCK(info.mode) then 
 | 
			
		||||
    if fpS_ISSOCK(info.st_mode) then 
 | 
			
		||||
      Writeln ('File is a socket');
 | 
			
		||||
    end;
 | 
			
		||||
end.
 | 
			
		||||
 | 
			
		||||
@ -1,13 +1,17 @@
 | 
			
		||||
Program Example54;
 | 
			
		||||
 | 
			
		||||
uses Linux;
 | 
			
		||||
uses BaseUnix,Termio;
 | 
			
		||||
 | 
			
		||||
{ Program to demonstrate the IOCtl function. }
 | 
			
		||||
 | 
			
		||||
var
 | 
			
		||||
  tios : Termios;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  IOCtl(1,TCGETS,@tios);
 | 
			
		||||
  {$ifdef FreeBSD}
 | 
			
		||||
    fpIOCtl(1,TIOCGETA,@tios);	// these constants are very OS dependant.
 | 
			
		||||
				// see the tcgetattr example for a better way
 | 
			
		||||
  {$endif}
 | 
			
		||||
  WriteLn('Input Flags  : $',hexstr(tios.c_iflag,8));
 | 
			
		||||
  WriteLn('Output Flags : $',hexstr(tios.c_oflag,8));
 | 
			
		||||
  WriteLn('Line Flags   : $',hexstr(tios.c_lflag,8));
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
Program Example55;
 | 
			
		||||
 | 
			
		||||
uses Linux;
 | 
			
		||||
uses TermIO;
 | 
			
		||||
 | 
			
		||||
{ Program to demonstrate the TCGetAttr/TCSetAttr/CFMakeRaw functions. }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
program example56;
 | 
			
		||||
 | 
			
		||||
uses linux;
 | 
			
		||||
uses Unix;
 | 
			
		||||
 | 
			
		||||
{ Program to demonstrate the Shell function }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user