|
@@ -62,7 +62,7 @@ Const
|
|
LOCK_NB = 4;
|
|
LOCK_NB = 4;
|
|
|
|
|
|
Type
|
|
Type
|
|
- Tpipe = array[1..2] of longint;
|
|
|
|
|
|
+ Tpipe = array[1..2] of cint;
|
|
|
|
|
|
pglob = ^tglob;
|
|
pglob = ^tglob;
|
|
tglob = record
|
|
tglob = record
|
|
@@ -115,12 +115,12 @@ var
|
|
tzname : array[boolean] of pchar;
|
|
tzname : array[boolean] of pchar;
|
|
|
|
|
|
{ timezone support }
|
|
{ timezone support }
|
|
-procedure GetLocalTimezone(timer:longint;var leap_correct,leap_hit:longint);
|
|
|
|
-procedure GetLocalTimezone(timer:longint);
|
|
|
|
|
|
+procedure GetLocalTimezone(timer:cint;var leap_correct,leap_hit:cint);
|
|
|
|
+procedure GetLocalTimezone(timer:cint);
|
|
procedure ReadTimezoneFile(fn:string);
|
|
procedure ReadTimezoneFile(fn:string);
|
|
function GetTimezoneFile:string;
|
|
function GetTimezoneFile:string;
|
|
|
|
|
|
-Function GetEpochTime: longint;
|
|
|
|
|
|
+Function GetEpochTime: cint;
|
|
procedure GetTime(var hour,min,sec,msec,usec:word);
|
|
procedure GetTime(var hour,min,sec,msec,usec:word);
|
|
procedure GetTime(var hour,min,sec,sec100:word);
|
|
procedure GetTime(var hour,min,sec,sec100:word);
|
|
procedure GetTime(var hour,min,sec:word);
|
|
procedure GetTime(var hour,min,sec:word);
|
|
@@ -150,12 +150,12 @@ Function Execle(Todo: AnsiString;Ep:ppchar):cint;
|
|
Function Execlp(Todo: string;Ep:ppchar):cint;
|
|
Function Execlp(Todo: string;Ep:ppchar):cint;
|
|
Function Execlp(Todo: Ansistring;Ep:ppchar):cint;
|
|
Function Execlp(Todo: Ansistring;Ep:ppchar):cint;
|
|
|
|
|
|
-Function Shell(const Command:String):Longint;
|
|
|
|
-Function Shell(const Command:AnsiString):Longint;
|
|
|
|
|
|
+Function Shell(const Command:String):cint;
|
|
|
|
+Function Shell(const Command:AnsiString):cint;
|
|
|
|
|
|
{Clone for FreeBSD is copied from the LinuxThread port, and rfork based}
|
|
{Clone for FreeBSD is copied from the LinuxThread port, and rfork based}
|
|
-function Clone(func:TCloneFunc;sp:pointer;flags:longint;args:pointer):longint;
|
|
|
|
-Function WaitProcess(Pid:longint):cint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
|
|
|
|
|
|
+function Clone(func:TCloneFunc;sp:pointer;flags:cint;args:pointer):cint;
|
|
|
|
+Function WaitProcess(Pid:cint):cint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
|
|
|
|
|
|
Function WIFSTOPPED(Status: Integer): Boolean;
|
|
Function WIFSTOPPED(Status: Integer): Boolean;
|
|
Function W_EXITCODE(ReturnCode, Signal: Integer): Integer;
|
|
Function W_EXITCODE(ReturnCode, Signal: Integer): Integer;
|
|
@@ -165,30 +165,30 @@ Function W_STOPCODE(Signal: Integer): Integer;
|
|
File Handling
|
|
File Handling
|
|
***************************}
|
|
***************************}
|
|
|
|
|
|
-Function fdFlush (fd : Longint) : Boolean;
|
|
|
|
|
|
+Function fdFlush (fd : cint) : cint;
|
|
|
|
|
|
-Function Flock (fd,mode : longint) : boolean;
|
|
|
|
-Function Flock (var T : text;mode : longint) : boolean;
|
|
|
|
-Function Flock (var F : File;mode : longint) : boolean;
|
|
|
|
|
|
+Function Flock (fd,mode : cint) : cint ;
|
|
|
|
+Function Flock (var T : text;mode : cint) : cint;
|
|
|
|
+Function Flock (var F : File;mode : cint) : cint;
|
|
|
|
|
|
-Function StatFS(Path:Pathstr;Var Info:tstatfs):Boolean;
|
|
|
|
-Function StatFS(Fd: Longint;Var Info:tstatfs):Boolean;
|
|
|
|
|
|
+Function StatFS(Path:Pathstr;Var Info:tstatfs):cint;
|
|
|
|
+Function fStatFS(Fd: cint;Var Info:tstatfs):cint;
|
|
|
|
|
|
-Function SelectText(var T:Text;TimeOut :PTimeVal):Longint;
|
|
|
|
-Function SelectText(var T:Text;TimeOut :Longint):Longint;
|
|
|
|
|
|
+Function SelectText(var T:Text;TimeOut :PTimeVal):cint;
|
|
|
|
+Function SelectText(var T:Text;TimeOut :cint):cint;
|
|
|
|
|
|
{**************************
|
|
{**************************
|
|
Directory Handling
|
|
Directory Handling
|
|
***************************}
|
|
***************************}
|
|
|
|
|
|
-procedure SeekDir(p:pdir;off:longint);
|
|
|
|
-function TellDir(p:pdir):longint;
|
|
|
|
|
|
+procedure SeekDir(p:pdir;loc:clong);
|
|
|
|
+function TellDir(p:pdir):clong;
|
|
|
|
|
|
{**************************
|
|
{**************************
|
|
Pipe/Fifo/Stream
|
|
Pipe/Fifo/Stream
|
|
***************************}
|
|
***************************}
|
|
|
|
|
|
-Function AssignPipe(var pipe_in,pipe_out:longint):cint;
|
|
|
|
|
|
+Function AssignPipe(var pipe_in,pipe_out:cint):cint;
|
|
Function AssignPipe(var pipe_in,pipe_out:text):cint;
|
|
Function AssignPipe(var pipe_in,pipe_out:text):cint;
|
|
Function AssignPipe(var pipe_in,pipe_out:file):cint;
|
|
Function AssignPipe(var pipe_in,pipe_out:file):cint;
|
|
Function PClose(Var F:text) : cint;
|
|
Function PClose(Var F:text) : cint;
|
|
@@ -208,21 +208,21 @@ Function GetHostName:String;
|
|
IOCtl/Termios Functions
|
|
IOCtl/Termios Functions
|
|
***************************}
|
|
***************************}
|
|
|
|
|
|
-Function TCGetAttr(fd:longint;var tios:TermIOS):boolean;
|
|
|
|
-Function TCSetAttr(fd:longint;OptAct:longint;const tios:TermIOS):boolean;
|
|
|
|
-Procedure CFSetISpeed(var tios:TermIOS;speed:Cardinal);
|
|
|
|
-Procedure CFSetOSpeed(var tios:TermIOS;speed:Cardinal);
|
|
|
|
-Procedure CFMakeRaw(var tios:TermIOS);
|
|
|
|
-Function TCSendBreak(fd,duration:longint):boolean;
|
|
|
|
-Function TCSetPGrp(fd,id:longint):boolean;
|
|
|
|
-Function TCGetPGrp(fd:longint;var id:longint):boolean;
|
|
|
|
-Function TCFlush(fd,qsel:longint):boolean;
|
|
|
|
-Function TCDrain(fd:longint):boolean;
|
|
|
|
-Function TCFlow(fd,act:longint):boolean;
|
|
|
|
-Function IsATTY(Handle:Longint):Boolean;
|
|
|
|
-Function IsATTY(var f:text):Boolean;
|
|
|
|
-function TTYname(Handle:Longint):string;
|
|
|
|
-function TTYname(var F:Text):string;
|
|
|
|
|
|
+Function TCGetAttr (fd:cint;var tios:TermIOS):cint;
|
|
|
|
+Function TCSetAttr (fd:cint;OptAct:cint;const tios:TermIOS):cint;
|
|
|
|
+Procedure CFSetISpeed (var tios:TermIOS;speed:Cardinal);
|
|
|
|
+Procedure CFSetOSpeed (var tios:TermIOS;speed:Cardinal);
|
|
|
|
+Procedure CFMakeRaw (var tios:TermIOS);
|
|
|
|
+Function TCSendBreak (fd,duration:cint):cint;
|
|
|
|
+Function TCSetPGrp (fd,id:cint) :cint;
|
|
|
|
+Function TCGetPGrp (fd:cint;var id:cint):cint;
|
|
|
|
+Function TCFlush (fd,qsel:cint):cint;
|
|
|
|
+Function TCDrain (fd:cint) :cint;
|
|
|
|
+Function TCFlow (fd,act:cint) :cint;
|
|
|
|
+Function IsATTY (Handle:cint) :cint;
|
|
|
|
+Function IsATTY (var f:text) :cint;
|
|
|
|
+function TTYname (Handle:cint):string;
|
|
|
|
+function TTYname (var F:Text) :string;
|
|
|
|
|
|
{**************************
|
|
{**************************
|
|
Memory functions
|
|
Memory functions
|
|
@@ -250,7 +250,6 @@ const
|
|
Utility functions
|
|
Utility functions
|
|
***************************}
|
|
***************************}
|
|
|
|
|
|
-Function Octal(l:longint):longint;
|
|
|
|
Function FExpand(Const Path: PathStr):PathStr;
|
|
Function FExpand(Const Path: PathStr):PathStr;
|
|
Function FSearch(const path:pathstr;dirlist:string):pathstr;
|
|
Function FSearch(const path:pathstr;dirlist:string):pathstr;
|
|
Function Glob(Const path:pathstr):pglob;
|
|
Function Glob(Const path:pathstr):pglob;
|
|
@@ -294,8 +293,8 @@ Function getenv(name:string):Pchar; external name 'FPC_SYSC_FPGETENV';
|
|
******************************************************************************}
|
|
******************************************************************************}
|
|
|
|
|
|
{ Most calls of WaitPID do not handle the result correctly, this funktion treats errors more correctly }
|
|
{ Most calls of WaitPID do not handle the result correctly, this funktion treats errors more correctly }
|
|
-Function WaitProcess(Pid:longint):cint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
|
|
|
|
-var ret,r,s : LongInt;
|
|
|
|
|
|
+Function WaitProcess(Pid:cint):cint; { like WaitPid(PID,@result,0) Handling of Signal interrupts (errno=EINTR), returning the Exitcode of Process (>=0) or -Status if terminated}
|
|
|
|
+var ret,r,s : cint;
|
|
begin
|
|
begin
|
|
s:=$7F00;
|
|
s:=$7F00;
|
|
|
|
|
|
@@ -322,7 +321,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function InternalCreateShellArgV(cmd:pChar; len:longint):ppchar;
|
|
|
|
|
|
+function InternalCreateShellArgV(cmd:pChar; len:cint):ppchar;
|
|
{
|
|
{
|
|
Create an argv which executes a command in a shell using /bin/sh -c
|
|
Create an argv which executes a command in a shell using /bin/sh -c
|
|
}
|
|
}
|
|
@@ -546,7 +545,7 @@ Function Shell(const Command:String):cint;
|
|
}
|
|
}
|
|
var
|
|
var
|
|
p : ppchar;
|
|
p : ppchar;
|
|
- pid : longint;
|
|
|
|
|
|
+ pid : cint;
|
|
begin
|
|
begin
|
|
p:=CreateShellArgv(command);
|
|
p:=CreateShellArgv(command);
|
|
pid:=fpfork;
|
|
pid:=fpfork;
|
|
@@ -569,7 +568,7 @@ Function Shell(const Command:AnsiString):cint;
|
|
}
|
|
}
|
|
var
|
|
var
|
|
p : ppchar;
|
|
p : ppchar;
|
|
- pid : longint;
|
|
|
|
|
|
+ pid : cint;
|
|
begin { Changes as above }
|
|
begin { Changes as above }
|
|
p:=CreateShellArgv(command);
|
|
p:=CreateShellArgv(command);
|
|
pid:=fpfork;
|
|
pid:=fpfork;
|
|
@@ -606,7 +605,7 @@ end;
|
|
Date and Time related calls
|
|
Date and Time related calls
|
|
******************************************************************************}
|
|
******************************************************************************}
|
|
|
|
|
|
-Function GetEpochTime: longint;
|
|
|
|
|
|
+Function GetEpochTime: cint;
|
|
{
|
|
{
|
|
Get the number of seconds since 00:00, January 1 1970, GMT
|
|
Get the number of seconds since 00:00, January 1 1970, GMT
|
|
the time NOT corrected any way
|
|
the time NOT corrected any way
|
|
@@ -670,15 +669,15 @@ End;
|
|
|
|
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
{$ifdef linux}
|
|
{$ifdef linux}
|
|
-Function stime (t : longint) : Boolean;
|
|
|
|
|
|
+Function stime (t : cint) : Boolean;
|
|
begin
|
|
begin
|
|
- stime:=do_SysCall(Syscall_nr_stime,longint(@t))=0;
|
|
|
|
|
|
+ stime:=do_SysCall(Syscall_nr_stime,cint(@t))=0;
|
|
end;
|
|
end;
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
|
|
{$ifdef BSD}
|
|
{$ifdef BSD}
|
|
-Function stime (t : longint) : Boolean;
|
|
|
|
|
|
+Function stime (t : cint) : Boolean;
|
|
begin
|
|
begin
|
|
end;
|
|
end;
|
|
{$endif}
|
|
{$endif}
|
|
@@ -722,18 +721,18 @@ begin
|
|
Execl:=ExecLE(ToDo,EnvP);
|
|
Execl:=ExecLE(ToDo,EnvP);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function Flock (var T : text;mode : longint) : boolean;
|
|
|
|
|
|
+Function Flock (var T : text;mode : cint) : cint;
|
|
begin
|
|
begin
|
|
Flock:=Flock(TextRec(T).Handle,mode);
|
|
Flock:=Flock(TextRec(T).Handle,mode);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function Flock (var F : File;mode : longint) : boolean;
|
|
|
|
|
|
+Function Flock (var F : File;mode : cint) :cint;
|
|
begin
|
|
begin
|
|
Flock:=Flock(FileRec(F).Handle,mode);
|
|
Flock:=Flock(FileRec(F).Handle,mode);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function SelectText(var T:Text;TimeOut :PTimeval):Longint;
|
|
|
|
|
|
+Function SelectText(var T:Text;TimeOut :PTimeval):cint;
|
|
Var
|
|
Var
|
|
F:TfdSet;
|
|
F:TfdSet;
|
|
begin
|
|
begin
|
|
@@ -750,7 +749,7 @@ begin
|
|
SelectText:=fpselect(textrec(T).handle+1,nil,@f,nil,TimeOut);
|
|
SelectText:=fpselect(textrec(T).handle+1,nil,@f,nil,TimeOut);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function SelectText(var T:Text;TimeOut :Longint):Longint;
|
|
|
|
|
|
+Function SelectText(var T:Text;TimeOut :cint):cint;
|
|
var
|
|
var
|
|
p : PTimeVal;
|
|
p : PTimeVal;
|
|
tv : TimeVal;
|
|
tv : TimeVal;
|
|
@@ -770,7 +769,7 @@ end;
|
|
Directory
|
|
Directory
|
|
******************************************************************************}
|
|
******************************************************************************}
|
|
|
|
|
|
-procedure SeekDir(p:pdir;off:longint);
|
|
|
|
|
|
+procedure SeekDir(p:pdir;loc:clong);
|
|
begin
|
|
begin
|
|
if p=nil then
|
|
if p=nil then
|
|
begin
|
|
begin
|
|
@@ -778,13 +777,13 @@ begin
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
{$ifndef bsd}
|
|
{$ifndef bsd}
|
|
- p^.dd_nextoff:=fplseek(p^.dd_fd,off,seek_set);
|
|
|
|
|
|
+ p^.dd_nextoff:=fplseek(p^.dd_fd,loc,seek_set);
|
|
{$endif}
|
|
{$endif}
|
|
p^.dd_size:=0;
|
|
p^.dd_size:=0;
|
|
p^.dd_loc:=0;
|
|
p^.dd_loc:=0;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TellDir(p:pdir):longint;
|
|
|
|
|
|
+function TellDir(p:pdir):clong;
|
|
begin
|
|
begin
|
|
if p=nil then
|
|
if p=nil then
|
|
begin
|
|
begin
|
|
@@ -857,7 +856,7 @@ Function AssignPipe(var pipe_in,pipe_out:text):cint;
|
|
be read from, the second one can be written to.
|
|
be read from, the second one can be written to.
|
|
}
|
|
}
|
|
var
|
|
var
|
|
- f_in,f_out : longint;
|
|
|
|
|
|
+ f_in,f_out : cint;
|
|
begin
|
|
begin
|
|
if AssignPipe(f_in,f_out)=-1 then
|
|
if AssignPipe(f_in,f_out)=-1 then
|
|
exit(-1);
|
|
exit(-1);
|
|
@@ -889,7 +888,7 @@ Function AssignPipe(var pipe_in,pipe_out:file):cint;
|
|
If the operation was unsuccesful,
|
|
If the operation was unsuccesful,
|
|
}
|
|
}
|
|
var
|
|
var
|
|
- f_in,f_out : longint;
|
|
|
|
|
|
+ f_in,f_out : cint;
|
|
begin
|
|
begin
|
|
if AssignPipe(f_in,f_out)=-1 then
|
|
if AssignPipe(f_in,f_out)=-1 then
|
|
exit(-1);
|
|
exit(-1);
|
|
@@ -1006,8 +1005,8 @@ Function POpen(var F:file;const Prog:String;rw:char):cint;
|
|
var
|
|
var
|
|
pipi,
|
|
pipi,
|
|
pipo : file;
|
|
pipo : file;
|
|
- pid : longint;
|
|
|
|
- pl : ^longint;
|
|
|
|
|
|
+ pid : cint;
|
|
|
|
+ pl : ^cint;
|
|
p,pp : ppchar;
|
|
p,pp : ppchar;
|
|
temp : string[255];
|
|
temp : string[255];
|
|
ret : cint;
|
|
ret : cint;
|
|
@@ -1095,8 +1094,8 @@ Function AssignStream(Var StreamIn,Streamout:text;Const Prog:String) : cint;
|
|
var
|
|
var
|
|
pipi,
|
|
pipi,
|
|
pipo : text;
|
|
pipo : text;
|
|
- pid : longint;
|
|
|
|
- pl : ^Longint;
|
|
|
|
|
|
+ pid : cint;
|
|
|
|
+ pl : ^cint;
|
|
begin
|
|
begin
|
|
AssignStream:=-1;
|
|
AssignStream:=-1;
|
|
if AssignPipe(streamin,pipo)=-1 Then
|
|
if AssignPipe(streamin,pipo)=-1 Then
|
|
@@ -1144,7 +1143,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: String): LongInt;
|
|
|
|
|
|
+function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: String):cint;
|
|
{
|
|
{
|
|
Starts the program in 'prog' and makes its input, output and error output the
|
|
Starts the program in 'prog' and makes its input, output and error output the
|
|
other end of three pipes, which are the stdin, stdout and stderr of a program
|
|
other end of three pipes, which are the stdin, stdout and stderr of a program
|
|
@@ -1159,8 +1158,8 @@ function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: Stri
|
|
}
|
|
}
|
|
var
|
|
var
|
|
PipeIn, PipeOut, PipeErr: text;
|
|
PipeIn, PipeOut, PipeErr: text;
|
|
- pid: LongInt;
|
|
|
|
- pl: ^LongInt;
|
|
|
|
|
|
+ pid: cint;
|
|
|
|
+ pl: ^cint;
|
|
begin
|
|
begin
|
|
AssignStream := -1;
|
|
AssignStream := -1;
|
|
|
|
|
|
@@ -1284,19 +1283,19 @@ end;
|
|
IOCtl and Termios calls
|
|
IOCtl and Termios calls
|
|
******************************************************************************}
|
|
******************************************************************************}
|
|
|
|
|
|
-Function TCGetAttr(fd:longint;var tios:TermIOS):boolean;
|
|
|
|
|
|
+Function TCGetAttr(fd:cint;var tios:TermIOS):cint;
|
|
begin
|
|
begin
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
- TCGetAttr:=fpIOCtl(fd,TCGETS,@tios)=0;
|
|
|
|
|
|
+ TCGetAttr:=fpIOCtl(fd,TCGETS,@tios);
|
|
{$else}
|
|
{$else}
|
|
- TCGETAttr:=fpIoCtl(Fd,TIOCGETA,@tios)=0;
|
|
|
|
|
|
+ TCGETAttr:=fpIoCtl(Fd,TIOCGETA,@tios);
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function TCSetAttr(fd:longint;OptAct:longint;const tios:TermIOS):boolean;
|
|
|
|
|
|
+Function TCSetAttr(fd:cint;OptAct:cint;const tios:TermIOS):cint;
|
|
var
|
|
var
|
|
- nr:longint;
|
|
|
|
|
|
+ nr:cint;
|
|
begin
|
|
begin
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
case OptAct of
|
|
case OptAct of
|
|
@@ -1312,11 +1311,11 @@ begin
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
fpsetErrNo(ESysEINVAL);
|
|
fpsetErrNo(ESysEINVAL);
|
|
- TCSetAttr:=false;
|
|
|
|
|
|
+ TCSetAttr:=-1;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
- TCSetAttr:=fpIOCtl(fd,nr,@Tios)=0;
|
|
|
|
|
|
+ TCSetAttr:=fpIOCtl(fd,nr,@Tios);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1369,60 +1368,60 @@ begin
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCSendBreak(fd,duration:longint):boolean;
|
|
|
|
|
|
+Function TCSendBreak(fd,duration:cint):cint;
|
|
begin
|
|
begin
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
- TCSendBreak:=fpIOCtl(fd,TCSBRK,pointer(duration))=0;
|
|
|
|
|
|
+ TCSendBreak:=fpIOCtl(fd,TCSBRK,pointer(duration));
|
|
{$else}
|
|
{$else}
|
|
- TCSendBreak:=fpIOCtl(fd,TIOCSBRK,0)=0;
|
|
|
|
|
|
+ TCSendBreak:=fpIOCtl(fd,TIOCSBRK,0);
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function TCSetPGrp(fd,id:longint):boolean;
|
|
|
|
|
|
+Function TCSetPGrp(fd,id:cint):cint;
|
|
begin
|
|
begin
|
|
- TCSetPGrp:=fpIOCtl(fd,TIOCSPGRP,pointer(id))=0;
|
|
|
|
|
|
+ TCSetPGrp:=fpIOCtl(fd,TIOCSPGRP,pointer(id));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function TCGetPGrp(fd:longint;var id:longint):boolean;
|
|
|
|
|
|
+Function TCGetPGrp(fd:cint;var id:cint):cint;
|
|
begin
|
|
begin
|
|
- TCGetPGrp:=fpIOCtl(fd,TIOCGPGRP,@id)=0;
|
|
|
|
|
|
+ TCGetPGrp:=fpIOCtl(fd,TIOCGPGRP,@id);
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCDrain(fd:longint):boolean;
|
|
|
|
|
|
+Function TCDrain(fd:cint):cint;
|
|
begin
|
|
begin
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
- TCDrain:=fpIOCtl(fd,TCSBRK,pointer(1))=0;
|
|
|
|
|
|
+ TCDrain:=fpIOCtl(fd,TCSBRK,pointer(1));
|
|
{$else}
|
|
{$else}
|
|
- TCDrain:=fpIOCtl(fd,TIOCDRAIN,0)=0; {Should set timeout to 1 first?}
|
|
|
|
|
|
+ TCDrain:=fpIOCtl(fd,TIOCDRAIN,0); {Should set timeout to 1 first?}
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function TCFlow(fd,act:longint):boolean;
|
|
|
|
|
|
+Function TCFlow(fd,act:cint):cint;
|
|
begin
|
|
begin
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
- TCFlow:=fpIOCtl(fd,TCXONC,pointer(act))=0;
|
|
|
|
|
|
+ TCFlow:=fpIOCtl(fd,TCXONC,pointer(act));
|
|
{$else}
|
|
{$else}
|
|
case act OF
|
|
case act OF
|
|
- TCOOFF : TCFlow:=fpIoctl(fd,TIOCSTOP,0)=0;
|
|
|
|
- TCOOn : TCFlow:=fpIOctl(Fd,TIOCStart,0)=0;
|
|
|
|
|
|
+ TCOOFF : TCFlow:=fpIoctl(fd,TIOCSTOP,0);
|
|
|
|
+ TCOOn : TCFlow:=fpIOctl(Fd,TIOCStart,0);
|
|
TCIOFF : {N/I}
|
|
TCIOFF : {N/I}
|
|
end;
|
|
end;
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCFlush(fd,qsel:longint):boolean;
|
|
|
|
|
|
+Function TCFlush(fd,qsel:cint):cint;
|
|
begin
|
|
begin
|
|
{$ifndef BSD}
|
|
{$ifndef BSD}
|
|
- TCFlush:=fpIOCtl(fd,TCFLSH,pointer(qsel))=0;
|
|
|
|
|
|
+ TCFlush:=fpIOCtl(fd,TCFLSH,pointer(qsel));
|
|
{$else}
|
|
{$else}
|
|
- TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel))=0;
|
|
|
|
|
|
+ TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
|
|
{$endif}
|
|
{$endif}
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function IsATTY (Handle:Longint):Boolean;
|
|
|
|
|
|
+Function IsATTY (Handle:cint):cint;
|
|
{
|
|
{
|
|
Check if the filehandle described by 'handle' is a TTY (Terminal)
|
|
Check if the filehandle described by 'handle' is a TTY (Terminal)
|
|
}
|
|
}
|
|
@@ -1433,7 +1432,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function IsATTY(var f: text):Boolean;
|
|
|
|
|
|
+Function IsATTY(var f: text):cint;
|
|
{
|
|
{
|
|
Idem as previous, only now for text variables.
|
|
Idem as previous, only now for text variables.
|
|
}
|
|
}
|
|
@@ -1442,7 +1441,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function TTYName(Handle:Longint):string;
|
|
|
|
|
|
+function TTYName(Handle:cint):string;
|
|
{
|
|
{
|
|
Return the name of the current tty described by handle f.
|
|
Return the name of the current tty described by handle f.
|
|
returns empty string in case of an error.
|
|
returns empty string in case of an error.
|
|
@@ -1499,8 +1498,7 @@ var
|
|
|
|
|
|
begin
|
|
begin
|
|
TTYName:='';
|
|
TTYName:='';
|
|
- fpfstat(handle,st);
|
|
|
|
- if (fpgeterrno<>0) and isatty (handle) then
|
|
|
|
|
|
+ if (fpfstat(handle,st)=-1) and (isatty (handle)<>-1) then
|
|
exit;
|
|
exit;
|
|
mydev:=st.st_dev;
|
|
mydev:=st.st_dev;
|
|
myino:=st.st_ino;
|
|
myino:=st.st_ino;
|
|
@@ -1521,13 +1519,14 @@ end;
|
|
Utility calls
|
|
Utility calls
|
|
******************************************************************************}
|
|
******************************************************************************}
|
|
|
|
|
|
-Function Octal(l:longint):longint;
|
|
|
|
|
|
+{
|
|
|
|
+Function Octal(l:cint):cint;
|
|
{
|
|
{
|
|
Convert an octal specified number to decimal;
|
|
Convert an octal specified number to decimal;
|
|
}
|
|
}
|
|
var
|
|
var
|
|
octnr,
|
|
octnr,
|
|
- oct : longint;
|
|
|
|
|
|
+ oct : cint;
|
|
begin
|
|
begin
|
|
octnr:=0;
|
|
octnr:=0;
|
|
oct:=0;
|
|
oct:=0;
|
|
@@ -1539,7 +1538,7 @@ begin
|
|
end;
|
|
end;
|
|
Octal:=oct;
|
|
Octal:=oct;
|
|
end;
|
|
end;
|
|
-
|
|
|
|
|
|
+}
|
|
|
|
|
|
{$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
|
|
{$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
|
|
{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
|
|
{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
|
|
@@ -1557,7 +1556,7 @@ Function FSearch(const path:pathstr;dirlist:string):pathstr;
|
|
}
|
|
}
|
|
Var
|
|
Var
|
|
NewDir : PathStr;
|
|
NewDir : PathStr;
|
|
- p1 : Longint;
|
|
|
|
|
|
+ p1 : cint;
|
|
Info : Stat;
|
|
Info : Stat;
|
|
Begin
|
|
Begin
|
|
{Replace ':' with ';'}
|
|
{Replace ':' with ';'}
|
|
@@ -1677,7 +1676,7 @@ begin
|
|
glob:=root;
|
|
glob:=root;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function GetFS (var T:Text):longint;
|
|
|
|
|
|
+Function GetFS (var T:Text):cint;
|
|
{
|
|
{
|
|
Get File Descriptor of a text file.
|
|
Get File Descriptor of a text file.
|
|
}
|
|
}
|
|
@@ -1689,7 +1688,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-Function GetFS(Var F:File):longint;
|
|
|
|
|
|
+Function GetFS(Var F:File):cint;
|
|
{
|
|
{
|
|
Get File Descriptor of an unTyped file.
|
|
Get File Descriptor of an unTyped file.
|
|
}
|
|
}
|
|
@@ -1705,7 +1704,6 @@ end;
|
|
Stat.Mode Macro's
|
|
Stat.Mode Macro's
|
|
--------------------------------}
|
|
--------------------------------}
|
|
|
|
|
|
-
|
|
|
|
Initialization
|
|
Initialization
|
|
InitLocalTime;
|
|
InitLocalTime;
|
|
|
|
|
|
@@ -1715,7 +1713,10 @@ End.
|
|
|
|
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.47 2003-11-14 17:30:14 marco
|
|
|
|
|
|
+ Revision 1.48 2003-11-17 10:05:51 marco
|
|
|
|
+ * threads for FreeBSD. Not working tho
|
|
|
|
+
|
|
|
|
+ Revision 1.47 2003/11/14 17:30:14 marco
|
|
* weeehoo linuxerror is no more :-)
|
|
* weeehoo linuxerror is no more :-)
|
|
|
|
|
|
Revision 1.46 2003/11/14 16:44:48 marco
|
|
Revision 1.46 2003/11/14 16:44:48 marco
|