AcePerl
view release on metacpan or search on metacpan
acelib/aceclientlib.c view on Meta::CPAN
#include <errno.h>
#include <rpc/rpc.h>
#include "rpcace.h"
#include "aceclient.h"
#include "regular.h"
BOOL accessDebug = FALSE ;
#include <signal.h> /* for alarm stuff */
#include <unistd.h> /* for pause() */
#include <sys/time.h> /* for setitimer() etc. */
static void wakeUp (int x)
{
static int sig = 0 ;
sig = x ;
signal (SIGALRM, wakeUp) ; /* reregister, otherwise you exit on SGI and LINUX */
}
static FILE *magicFileOpen (char *name)
acelib/aceclientlib.c view on Meta::CPAN
*++cp = 0 ;
if (!(f = fopen(dirName, "r")))
{ if (accessDebug)
printf ("// directory %s not readable\n", dirName) ;
return 0 ;
}
fclose (f) ;
}
{ int i ;
struct itimerval tval ;
signal (SIGALRM, wakeUp) ;
tval.it_interval.tv_sec = 0 ;
tval.it_interval.tv_usec = 5000 ; /* 5ms reload */
tval.it_value.tv_sec = 0 ;
tval.it_value.tv_usec = 1000 ; /* 1ms initial */
setitimer (ITIMER_REAL, &tval, 0) ;
for (i = 0 ; i < 1000 ; ++i) /* 5 seconds */
{ pause () ; /* wait until SIGALRM handled */
f = fopen (name, "r") ;
if (f)
{ if (accessDebug)
printf ("// found %s after %d msecs\n", name, 5*i+1) ;
tval.it_interval.tv_usec = tval.it_value.tv_usec = 0 ;
setitimer (ITIMER_REAL, &tval, 0) ;
return f ;
}
}
if (accessDebug)
printf ("// failed to find %s after %d msecs\n", name, 5*i+1) ;
tval.it_interval.tv_usec = tval.it_value.tv_usec = 0 ;
setitimer (ITIMER_REAL, &tval, 0) ;
}
return 0 ;
}
static int getMagic (int magic1, char *nm)
{ int magic = 0, magic2 = 0, magic3 = 0 ;
FILE *f ;
int level ;
char *cp ;
acelib/wh/mytime.h view on Meta::CPAN
/* march 94: these functions can be used in conjunction
with the _DateType fundamental type which can
now be used in the same way as _Int _Float in models.wrm
*/
typedef unsigned int mytime_t; /* for all machines */
/* define some missing prototypes for SunOS */
#ifdef SUN
time_t time (time_t *timer) ;
mysize_t strftime (char *buf, mysize_t bufsize, const char *fmt,
const struct tm *tm) ;
/* double difftime (time_t , time_t) ; seems bsent on Sun */
#define difftime(__t1,__t2) ((__t1) - (__t2))
time_t mktime (struct tm *) ;
#else /* non-SunOS */
#include <time.h>
( run in 1.246 second using v1.01-cache-2.11-cpan-49f99fa48dc )