* improve tcflow

git-svn-id: trunk@21234 -
This commit is contained in:
marco 2012-05-05 15:18:50 +00:00
parent 833318e6fb
commit 0584cfe9d5

View File

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