Diff for /gforth/engine/io.c between versions 1.16 and 1.19

version 1.16, 2003/03/09 15:17:03 version 1.19, 2006/04/04 13:36:37
Line 1 Line 1
 /* direct key io driver  /* direct key io driver
   
   Copyright (C) 1995,1996,1997,1998,1999,2002 Free Software Foundation, Inc.    Copyright (C) 1995,1996,1997,1998,1999,2002,2003 Free Software Foundation, Inc.
   
   This file is part of Gforth.    This file is part of Gforth.
   
Line 447  void deprep_terminal () Line 447  void deprep_terminal ()
 #define VTIME VEOL  #define VTIME VEOL
 #endif  #endif
   
   #include <locale.h>
   
 void prep_terminal ()  void prep_terminal ()
 {  {
   int tty = fileno (stdin);    int tty = fileno (stdin);
Line 472  void prep_terminal () Line 474  void prep_terminal ()
     return;      /* added by MdG */      return;      /* added by MdG */
   }      /* added by MdG */    }      /* added by MdG */
         
     setlocale(LC_ALL, "");
   
   /* Try to keep this function from being INTerrupted.  We can do it    /* Try to keep this function from being INTerrupted.  We can do it
      on POSIX and systems with BSD-like signal handling. */       on POSIX and systems with BSD-like signal handling. */
 #if defined (HAVE_POSIX_SIGNALS)  #if defined (HAVE_POSIX_SIGNALS)
Line 615  void deprep_terminal () Line 619  void deprep_terminal ()
   
 /* If a character is available to be read, then read it  /* If a character is available to be read, then read it
    and stuff it into IBUFFER.  Otherwise, just return. */     and stuff it into IBUFFER.  Otherwise, just return. */
   
 long pending = -1L;  long pending = -1L;
   /* !! This is a bug: if key_avail(file1) is followed by getkey(file2),
      the getkey(file2) can return the character from file1. - anton */
   
   /* Moreover, key_avail and getkey bypass the buffering of the FILE *,
      leading to unpleasant effects if KEY-FILE and KEY?-FILE are mixed
      with READ-FILE and READ-LINE */
   
 long key_avail (FILE * stream)  long key_avail (FILE * stream)
 {  {
Line 627  long key_avail (FILE * stream) Line 636  long key_avail (FILE * stream)
   if(!terminal_prepped)  prep_terminal();    if(!terminal_prepped)  prep_terminal();
   
 #if defined(FIONREAD) && !defined(_WIN32)  #if defined(FIONREAD) && !defined(_WIN32)
     /* !! What is the point of this part? it does not affect
        chars_avail, and "result" is never used - anton */
   if(isatty (tty)) {    if(isatty (tty)) {
     result = ioctl (tty, FIONREAD, &chars_avail);      result = ioctl (tty, FIONREAD, &chars_avail);
   }    }

Removed from v.1.16  
changed lines
  Added in v.1.19


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>