Article View: comp.sources.bugs
Article #317unofficial patch to ephem 4.13
From: Tom Horsley
Date: Thu, 12 Apr 1990 12:37
Date: Thu, 12 Apr 1990 12:37
57 lines
1940 bytes
1940 bytes
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 <sys/time.h>
+ #endif
#include <sgtty.h>
#include <signal.h>
#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! ========================
Technical Details
Message-ID:
<TOM.90Apr12083743@hcx2.ssd.csd.harris.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!novavax!hcx1!tomShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <TOM.90Apr12083743@hcx2.ssd.csd.harris.com> Date: 12 Apr 90 12:37:43 GMT Sender: news@hcx1.SSD.CSD.HARRIS.COM Organization: Harris Computer Systems Division Lines: 57