mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:49:11 +02:00
* improve tcflow
git-svn-id: trunk@21234 -
This commit is contained in:
parent
833318e6fb
commit
0584cfe9d5
@ -107,14 +107,38 @@ begin
|
||||
TCDrain:=fpIOCtl(fd,TIOCDRAIN,nil); {Should set timeout to 1 first?}
|
||||
end;
|
||||
|
||||
const
|
||||
_POSIX_VDISABLE = $ff;
|
||||
|
||||
Function TCFlow(fd,act:cint):cint; {$ifdef VER2_0}inline;{$endif}
|
||||
var
|
||||
term:Termios;
|
||||
c : cuchar;
|
||||
tmp : cint;
|
||||
begin
|
||||
case act OF
|
||||
TCOOFF : TCFlow:=fpIoctl(fd,TIOCSTOP,nil);
|
||||
TCOOn : TCFlow:=fpIOctl(Fd,TIOCStart,nil);
|
||||
TCIOFF : {N/I}
|
||||
end;
|
||||
TCION,
|
||||
TCIOFF : begin
|
||||
if tcgetattr(fd, term) = -1 then
|
||||
exit(-1);
|
||||
if act=TCIOFF then
|
||||
tmp:=VSTOP
|
||||
else
|
||||
tmp:=VSTART;
|
||||
c:=term.c_cc[tmp];
|
||||
if (c <> _POSIX_VDISABLE) and
|
||||
(fpwrite(fd, c, sizeof(c)) = -1) then
|
||||
exit (-1);
|
||||
TCFlow:=0;
|
||||
end;
|
||||
else
|
||||
begin
|
||||
errno := esysEINVAL;
|
||||
exit(-1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
const FREAD = 1; // marked "BSD visible"
|
||||
|
Loading…
Reference in New Issue
Block a user