* isatty return cint again

This commit is contained in:
peter 2004-07-09 19:03:35 +00:00
parent eb2dd5c4f8
commit cf15e8407e
7 changed files with 38 additions and 35 deletions

View File

@ -1,3 +1,7 @@
{
$Id$
}
{******************************************************************************
IOCtl and Termios calls
******************************************************************************}
@ -140,18 +144,18 @@ begin
{$endif}
end;
Function IsATTY (Handle:cint):boolean;
Function IsATTY (Handle:cint):cint;
{
Check if the filehandle described by 'handle' is a TTY (Terminal)
}
var
t : Termios;
begin
IsAtty:=TCGetAttr(Handle,t)<>-1;
IsAtty:=TCGetAttr(Handle,t);
end;
Function IsATTY(var f: text):boolean;
Function IsATTY(var f: text):cint;
{
Idem as previous, only now for text variables.
}
@ -159,3 +163,9 @@ begin
IsATTY:=IsaTTY(textrec(f).handle);
end;
{
$Log$
Revision 1.4 2004-07-09 19:03:35 peter
* isatty return cint again
}

View File

@ -1257,7 +1257,7 @@ var
c : char;
i : longint;
Begin
if isATTY(F.Handle) then
if isATTY(F.Handle)<>-1 then
begin
F.BufPos := 0;
i := 0;
@ -1566,10 +1566,10 @@ Initialization
Reset(Input);
TextRec(Input).Handle:=StdInputHandle;
{ Are we redirected to a file ? }
OutputRedir:=not IsAtty(TextRec(Output).Handle);
OutputRedir:= IsAtty(TextRec(Output).Handle)=-1;
{ does the input come from another console or from a file? }
InputRedir :=
not IsAtty(TextRec(Input).Handle) or
(IsAtty(TextRec(Input).Handle)=-1) or
(not OutputRedir and
(TTYName(TextRec(Input).Handle) <> TTYName(TextRec(Output).Handle)));
{ Get Size of terminal and set WindMax to the window }
@ -1611,10 +1611,8 @@ Finalization
End.
{
$Log$
Revision 1.18 2004-07-08 13:23:21 daniel
* gpm now uses a Pascal translation of libgpm instead of linking against
it.
* isatty result type changed into boolean
Revision 1.19 2004-07-09 19:03:35 peter
* isatty return cint again
Revision 1.17 2004/02/08 16:22:20 michael
+ Moved CRT interface to common include file

View File

@ -470,11 +470,11 @@ begin
end
else
begin {use your current vc}
if isatty(0) then
if isatty(0)<>0 then
tty:=ttyname(0); { stdin }
if (tty='') and isatty(1) then
if (tty='') and (isatty(1)<>0) then
tty:=ttyname(1); { stdout }
if (tty='') and isatty(2) then
if (tty='') and (isatty(2)<>0) then
tty:=ttyname(2); { stderr }
if (tty='') then
begin
@ -953,7 +953,10 @@ end;
end.
{
$Log$
Revision 1.7 2004-07-08 13:23:21 daniel
Revision 1.8 2004-07-09 19:03:35 peter
* isatty return cint again
Revision 1.7 2004/07/08 13:23:21 daniel
* gpm now uses a Pascal translation of libgpm instead of linking against
it.
* isatty result type changed into boolean

View File

@ -307,7 +307,7 @@ var
begin
IsConsole:=false;
{ check for tty }
if IsATTY(stdinputhandle) then
if (IsATTY(stdinputhandle)<>-1) then
begin
{ running on a tty, find out whether locally or remotely }
ThisTTY:=TTYName(stdinputhandle);
@ -1532,10 +1532,8 @@ begin
end.
{
$Log$
Revision 1.18 2004-07-08 13:23:21 daniel
* gpm now uses a Pascal translation of libgpm instead of linking against
it.
* isatty result type changed into boolean
Revision 1.19 2004-07-09 19:03:35 peter
* isatty return cint again
Revision 1.17 2003/11/19 17:11:40 marco
* termio unit

View File

@ -25,17 +25,15 @@ 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) :boolean;
Function IsATTY (var f:text) :boolean;
Function IsATTY (Handle:cint) :cint;
Function IsATTY (var f:text) :cint;
function TTYname (Handle:cint):string;
function TTYname (var F:Text) :string;
{
$Log$
Revision 1.2 2004-07-08 13:23:21 daniel
* gpm now uses a Pascal translation of libgpm instead of linking against
it.
* isatty result type changed into boolean
Revision 1.3 2004-07-09 19:03:35 peter
* isatty return cint again
Revision 1.1 2003/11/19 17:13:00 marco
* new termio units

View File

@ -72,7 +72,7 @@ var
begin
TTYName:='';
if (fpfstat(handle,st)=-1) and isatty(handle) then
if (fpfstat(handle,st)=-1) and (isatty (handle)<>-1) then
exit;
mydev:=st.st_dev;
myino:=st.st_ino;
@ -90,10 +90,8 @@ end;
{
$Log$
Revision 1.2 2004-07-08 13:23:21 daniel
* gpm now uses a Pascal translation of libgpm instead of linking against
it.
* isatty result type changed into boolean
Revision 1.3 2004-07-09 19:03:35 peter
* isatty return cint again
Revision 1.1 2003/11/19 17:13:00 marco
* new termio units

View File

@ -625,7 +625,7 @@ begin
{$endif CPUI386}
{ check for tty }
ThisTTY:=TTYName(stdinputhandle);
if IsATTY(stdinputhandle) then
if (IsATTY(stdinputhandle)<>-1) then
begin
{ save current terminal characteristics and remove rawness }
prepareInitVideo;
@ -899,10 +899,8 @@ initialization
end.
{
$Log$
Revision 1.22 2004-07-08 13:23:21 daniel
* gpm now uses a Pascal translation of libgpm instead of linking against
it.
* isatty result type changed into boolean
Revision 1.23 2004-07-09 19:03:35 peter
* isatty return cint again
Revision 1.21 2004/07/03 13:29:23 daniel
* Compilation fix.