Diff for /gforth/engine/io.c between versions 1.42 and 1.43

version 1.42, 2012/04/03 22:57:00 version 1.43, 2012/04/06 16:34:07
Line 55  typedef unsigned int uint32_t; Line 55  typedef unsigned int uint32_t;
 #include "io.h"  #include "io.h"
   
 #ifndef MSDOS  #ifndef MSDOS
   #include <poll.h>
 #if defined (__GNUC__)  #if defined (__GNUC__)
 #  define alloca __builtin_alloca  #  define alloca __builtin_alloca
 #else  #else
Line 663  int gf_ungottenc(FILE *stream) Line 664  int gf_ungottenc(FILE *stream)
 long key_avail (FILE *stream)  long key_avail (FILE *stream)
 {  {
   int tty = fileno (stream);    int tty = fileno (stream);
   fd_set selin;    struct pollfd fds = { tty, POLLIN, 0 };
   static struct timeval now = { 0 , 0 };  
   int chars_avail;    int chars_avail;
   
   if (gf_ungottenc(stream))    if (gf_ungottenc(stream))
Line 679  long key_avail (FILE *stream) Line 679  long key_avail (FILE *stream)
   } else    } else
 #endif  #endif
   {    {
     FD_ZERO(&selin);      chars_avail = poll(&fds, 1, 0);
     FD_SET(tty, &selin);  
     chars_avail = select(1, &selin, NULL, NULL, &now);  
   }    }
   if (chars_avail > 0) {    if (chars_avail > 0) {
     /* getc won't block */      /* getc won't block */

Removed from v.1.42  
changed lines
  Added in v.1.43


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