Browse Source

* fix isatty return value checks

git-svn-id: trunk@1292 -
peter 20 năm trước cách đây
mục cha
commit
9ea69cfec9

+ 3 - 3
rtl/unix/crt.pp

@@ -1265,7 +1265,7 @@ var
   c : char;
   c : char;
   i : longint;
   i : longint;
 Begin
 Begin
-  if isATTY(F.Handle)<>-1 then
+  if isATTY(F.Handle)=1 then
     begin
     begin
       F.BufPos := 0;
       F.BufPos := 0;
       i := 0;
       i := 0;
@@ -1574,10 +1574,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:= IsAtty(TextRec(Output).Handle)=-1;
+  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 :=
-   (IsAtty(TextRec(Input).Handle)=-1) 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 }

+ 1 - 1
rtl/unix/keyboard.pp

@@ -304,7 +304,7 @@ var
 begin
 begin
   IsConsole:=false;
   IsConsole:=false;
   { check for tty }
   { check for tty }
-  if (IsATTY(stdinputhandle)<>-1) 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);

+ 1 - 1
rtl/unix/ttyname.inc

@@ -71,7 +71,7 @@ var
 
 
 begin
 begin
   TTYName:='';
   TTYName:='';
-  if (fpfstat(handle,st)=-1) and (isatty (handle)<>-1) 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;

+ 1 - 1
rtl/unix/video.pp

@@ -621,7 +621,7 @@ begin
 {$endif CPUI386}
 {$endif CPUI386}
   { check for tty }
   { check for tty }
   ThisTTY:=TTYName(stdinputhandle);
   ThisTTY:=TTYName(stdinputhandle);
-  if (IsATTY(stdinputhandle)<>-1) then
+  if (IsATTY(stdinputhandle)=1) then
    begin
    begin
      { save current terminal characteristics and remove rawness }
      { save current terminal characteristics and remove rawness }
      prepareInitVideo;
      prepareInitVideo;