From eadb3643c47eaee9634a2e1384243404edafe5f4 Mon Sep 17 00:00:00 2001 From: Mark Anderson Date: Wed, 4 Aug 1993 17:02:50 +0000 Subject: [PATCH] #define nint, exp10 for non-SUN environs, replace usleep() with closest sleep(), #ifdef sun where appropriate --- src/util/cmdClient.c | 11 ++++++++++- src/util/cmdProto.c | 3 +++ src/util/guiSubr.c | 5 +++++ src/util/pprPlot.c | 3 +++ src/util/recListProg.c | 12 ++++++++++++ src/util/sydPlot.c | 3 +++ 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/util/cmdClient.c b/src/util/cmdClient.c index 4316fab9a..9137499b2 100644 --- a/src/util/cmdClient.c +++ b/src/util/cmdClient.c @@ -68,6 +68,8 @@ #include #include +#include + /*----------------------------------------------------------------------------- @@ -223,7 +225,7 @@ int portNum; /* I port number for server */ printf("null message from server\n"); } } - usleep(100000); + sleep(1); } cmdclTaskWrapup: @@ -285,7 +287,14 @@ char *buf; int fdSetWidth; /* width of select bit mask */ struct timeval fdSetTimeout;/* timeout interval for select */ + struct rlimit rlp; + +/* MDA - replace obsolete system call fdSetWidth = getdtablesize(); +*/ + getrlimit(RLIMIT_NOFILE,&rlp); + fdSetWidth = rlp.rlim_cur; + fdSetTimeout.tv_sec = 0; fdSetTimeout.tv_usec = 0; FD_ZERO(&fdSet); diff --git a/src/util/cmdProto.c b/src/util/cmdProto.c index 75d1154f5..a2024bfd0 100644 --- a/src/util/cmdProto.c +++ b/src/util/cmdProto.c @@ -238,7 +238,10 @@ char *argv[]; /* command line args */ fflush(stdout); /* flushes needed for socket I/O */ fflush(stderr); fflush(pglZzzCxCmd->dataOut); + sleep(1); +/* MDA - usleep isn't POSIX usleep(100000); /* sleep .1 second */ +*/ } return OK; diff --git a/src/util/guiSubr.c b/src/util/guiSubr.c index 9225f0380..918cb2148 100644 --- a/src/util/guiSubr.c +++ b/src/util/guiSubr.c @@ -1,3 +1,6 @@ +#ifndef sun + +#else /* @(#)guiSubr.c 1.10 11/12/92 * Author: Roger A. Cole * Date: 02-08-91 @@ -3439,3 +3442,5 @@ void *callbackArg; /* I argument to pass to callback function */ (int)(fmod(seconds, 1.)*1000000.); notify_set_itimer_func(callbackArg, callbackFn, ITIMER_REAL, &t, NULL); } + +#endif diff --git a/src/util/pprPlot.c b/src/util/pprPlot.c index 4d56b53f9..9df453848 100644 --- a/src/util/pprPlot.c +++ b/src/util/pprPlot.c @@ -5984,7 +5984,10 @@ int seconds; /* I number of seconds (added to usec) to sleep */ int usec; /* I number of micro-sec (added to sec) to sleep */ { #ifndef vxWorks +/* MDA - usleep isn't POSIX usleep((unsigned)(seconds*1000000 + usec)); +*/ + sleep((unsigned int)seconds); #else int ticks; static int ticksPerSec=0; diff --git a/src/util/recListProg.c b/src/util/recListProg.c index 0f8c728ca..a276e6b16 100644 --- a/src/util/recListProg.c +++ b/src/util/recListProg.c @@ -78,6 +78,18 @@ extern struct ca_static *ca_static; } #endif + +/* nint, exp10 aren't ANSI-C or POSIX */ +# ifndef sun +# ifndef nint +# define nint(value) (value>=0 ? (int)((value)+.5) : (int)((value)-.5)) +# endif +# ifndef exp10 +# define exp10(value) (exp(value * log(10.))) +# endif +# endif + + #define FLD_DIM 20 static int nFld; static char *(fields[FLD_DIM]); diff --git a/src/util/sydPlot.c b/src/util/sydPlot.c index abebb75fb..b39dc6f6d 100644 --- a/src/util/sydPlot.c +++ b/src/util/sydPlot.c @@ -1,3 +1,5 @@ +#ifndef sun +#else /* @(#)sydPlot.c 1.10 2/23/93 * Author: Roger A. Cole * Date: 12-04-90 @@ -4069,3 +4071,4 @@ SYD_PL_MSTR *pMstr; /* I pointer to master plot structure */ pSlave = pSlave->pNext; } } +#endif