From 869865269995d67e5c30f45393e83eeee5229647 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 22 Feb 1998 16:45:08 +0000 Subject: EMX changes for OS/2. svn path=/trunk/; revision=1668 --- fetchmail.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'fetchmail.c') diff --git a/fetchmail.c b/fetchmail.c index 1d937873..af5e474b 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -84,6 +84,7 @@ static int lastsig; /* last signal received */ static void termhook(); /* forward declaration of exit hook */ + RETSIGTYPE donothing(sig) int sig; {signal(sig, donothing); lastsig = sig;} #ifdef HAVE_ON_EXIT @@ -96,6 +97,19 @@ static void unlockit(void) unlink(lockfile); } +#ifdef __EMX__ +/* Various EMX-specific definitions */ +int itimerflag; +void itimerthread(void* dummy) { + if (outlevel == O_VERBOSE) + fprintf(stderr, "fetchmail: thread sleeping for %d sec.\n", poll_interval); + while(1) { + _sleep2(poll_interval*1000); + kill((getpid()), SIGALRM); + } +} +#endif + int main (int argc, char **argv) { int st, bkgd = FALSE; @@ -541,6 +555,7 @@ int main (int argc, char **argv) * has to have a BSDoid socket layer to work at all. */ { +#ifndef __EMX__ struct itimerval ntimeout; ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0; @@ -551,6 +566,12 @@ int main (int argc, char **argv) signal(SIGALRM, donothing); pause(); signal(SIGALRM, SIG_IGN); +#else /* EMX */ + signal(SIGALRM, donothing); + _beginthread(itimerthread, NULL, 32768, NULL); + pause(); + signal(SIGALRM, SIG_IGN); +#endif /* ! EMX */ if (lastsig == SIGUSR1 || ((poll_interval && !getuid()) && lastsig == SIGHUP)) { @@ -771,7 +792,6 @@ static int load_params(int argc, char **argv, int optind) /* check and daemon options are not compatible */ if (check_only && poll_interval) poll_interval = 0; - return(implicitmode); } -- cgit v1.2.3