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

View File

@ -470,11 +470,11 @@ begin
end end
else else
begin {use your current vc} begin {use your current vc}
if isatty(0) then if isatty(0)<>0 then
tty:=ttyname(0); { stdin } tty:=ttyname(0); { stdin }
if (tty='') and isatty(1) then if (tty='') and (isatty(1)<>0) then
tty:=ttyname(1); { stdout } tty:=ttyname(1); { stdout }
if (tty='') and isatty(2) then if (tty='') and (isatty(2)<>0) then
tty:=ttyname(2); { stderr } tty:=ttyname(2); { stderr }
if (tty='') then if (tty='') then
begin begin
@ -953,7 +953,10 @@ end;
end. end.
{ {
$Log$ $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 * gpm now uses a Pascal translation of libgpm instead of linking against
it. it.
* isatty result type changed into boolean * isatty result type changed into boolean

View File

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

View File

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

View File

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

View File

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