Diff for /gforth/engine/io.c between versions 1.24 and 1.29

version 1.24, 2006/04/14 12:18:50 version 1.29, 2007/07/01 20:01:32
Line 1 Line 1
 /* direct key io driver  /* direct key io driver
   
   Copyright (C) 1995,1996,1997,1998,1999,2002,2003 Free Software Foundation, Inc.    Copyright (C) 1995,1996,1997,1998,1999,2002,2003,2006 Free Software Foundation, Inc.
   
   This file is part of Gforth.    This file is part of Gforth.
   
Line 622  long key_avail (FILE * stream) Line 622  long key_avail (FILE * stream)
 {  {
   int tty = fileno (stream);    int tty = fileno (stream);
   fd_set selin;    fd_set selin;
   static int now[2] = { 0 , 0 };    static struct timespec now = { 0 , 0 };
   int res;    int res;
   
   setvbuf(stream, NULL, _IONBF, 0);    setvbuf(stream, NULL, _IONBF, 0);
Line 631  long key_avail (FILE * stream) Line 631  long key_avail (FILE * stream)
   
   FD_ZERO(&selin);    FD_ZERO(&selin);
   FD_SET(tty, &selin);    FD_SET(tty, &selin);
   return select(1, &selin, NULL, NULL, now);    return select(1, &selin, NULL, NULL, &now);
 }  }
   
 /* Get a key from the buffer of characters to be read.  /* Get a key from the buffer of characters to be read.
Line 651  Cell getkey(FILE * stream) Line 651  Cell getkey(FILE * stream)
     prep_terminal();      prep_terminal();
   
   result = fread(&c, sizeof(c), 1, stream);    result = fread(&c, sizeof(c), 1, stream);
   return result==0 ? EOF : c;    return result==0 ? (errno == EINTR ? 12 : EOF) : c;
 }  }
   
   #ifdef STANDALONE
   void emit_char(char x)
   {
     putc(x, stdout);
   }
   
   void type_chars(char *addr, unsigned int l)
   {
     fwrite(addr, l, 1, stdout);
   }
   #endif
   
 #ifdef TEST  #ifdef TEST
   
 #include <time.h>  #include <time.h>

Removed from v.1.24  
changed lines
  Added in v.1.29


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