From cf15e8407e62ad6c65a2f77ae6be0d0c942db2f7 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 9 Jul 2004 19:03:35 +0000 Subject: [PATCH] * isatty return cint again --- rtl/linux/termiosproc.inc | 16 +++++++++++++--- rtl/unix/crt.pp | 12 +++++------- rtl/unix/gpm.pp | 11 +++++++---- rtl/unix/keyboard.pp | 8 +++----- rtl/unix/termiosh.inc | 10 ++++------ rtl/unix/ttyname.inc | 8 +++----- rtl/unix/video.pp | 8 +++----- 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/rtl/linux/termiosproc.inc b/rtl/linux/termiosproc.inc index 993ebd3796..23c74bb437 100644 --- a/rtl/linux/termiosproc.inc +++ b/rtl/linux/termiosproc.inc @@ -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 + +} diff --git a/rtl/unix/crt.pp b/rtl/unix/crt.pp index 1c007f416f..7d56d931ac 100644 --- a/rtl/unix/crt.pp +++ b/rtl/unix/crt.pp @@ -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 diff --git a/rtl/unix/gpm.pp b/rtl/unix/gpm.pp index a237d690b4..1510d0eb43 100644 --- a/rtl/unix/gpm.pp +++ b/rtl/unix/gpm.pp @@ -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 diff --git a/rtl/unix/keyboard.pp b/rtl/unix/keyboard.pp index b4f227b9b0..4f2172ebe2 100644 --- a/rtl/unix/keyboard.pp +++ b/rtl/unix/keyboard.pp @@ -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 diff --git a/rtl/unix/termiosh.inc b/rtl/unix/termiosh.inc index 657da93e81..2486bc3d03 100644 --- a/rtl/unix/termiosh.inc +++ b/rtl/unix/termiosh.inc @@ -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 diff --git a/rtl/unix/ttyname.inc b/rtl/unix/ttyname.inc index 1f669050c4..7b3488c6a5 100644 --- a/rtl/unix/ttyname.inc +++ b/rtl/unix/ttyname.inc @@ -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 diff --git a/rtl/unix/video.pp b/rtl/unix/video.pp index b5ccc1e7b6..b0fe96c272 100644 --- a/rtl/unix/video.pp +++ b/rtl/unix/video.pp @@ -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.