Path: utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!novavax!hcx1!tom From: tom@ssd.csd.harris.com (Tom Horsley) Newsgroups: comp.sources.bugs Subject: unofficial patch to ephem 4.13 Message-ID: Date: 12 Apr 90 12:37:43 GMT Sender: news@hcx1.SSD.CSD.HARRIS.COM Organization: Harris Computer Systems Division Lines: 57 Here is a patch to ephem version 4.13 that uses select() to check for a pending keystroke. On my system select() seems to work better than either of the two alternatives that are already built in. *** io.c.orig Thu Apr 12 07:29:36 1990 --- io.c Thu Apr 12 07:30:13 1990 *************** *** 21,26 **** --- 21,27 ---- */ #define UNIX + #define USE_SELECT /* #define USE_NDELAY */ /* #define TURBO_C */ /* #define USE_ANSISYS */ *************** *** 29,34 **** --- 30,38 ---- #include "screen.h" #ifdef UNIX + #ifdef USE_SELECT + #include + #endif #include #include #ifdef USE_NDELAY *************** *** 81,90 **** --- 85,104 ---- sav_char = 0; return (sav_char ? 0 : -1); #else + #ifdef USE_SELECT + struct timeval timeout; + int readfs = 1<<0; + int nfound; + + memset((char *)&timeout, 0, sizeof(struct timeval)); + nfound = select(1, &readfs, 0, 0, &timeout); + return ((nfound > 0) ? 0 : -1); + #else long n; if (!ttysetup) setuptty(); ioctl (0, FIONREAD, &n); return (n > 0 ? 0 : -1); + #endif #endif } -- ===================================================================== domain: tahorsley@ssd.csd.harris.com USMail: Tom Horsley uucp: ...!novavax!hcx1!tahorsley 511 Kingbird Circle or ...!uunet!hcx1!tahorsley Delray Beach, FL 33444 ======================== Aging: Just say no! ========================