diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | daemon.c | 5 | ||||
-rw-r--r-- | driver.c | 2 | ||||
-rw-r--r-- | fetchmail.c | 22 | ||||
-rw-r--r-- | fetchmail.h | 13 | ||||
-rw-r--r-- | rcfile_y.y | 3 |
6 files changed, 43 insertions, 3 deletions
@@ -27,6 +27,7 @@ fetchmail-4.3.8 (): * Added /-suffix capability to specify a port or service on smtphost args. * More fixes by Nicholas Pitre. * Fix for core-dump bug in the new UID-marking code by timw@aracnet.com. +* EMX changes support running fetchmail under OS/2. There are 274 people on fetchmail-friends and 138 on fetchmail-announce. @@ -127,8 +127,9 @@ daemonize (const char *logfile, void (*termhook)(int)) } #elif defined(SIGTSTP) /* BSD */ /* change process group */ +#ifndef __EMX__ setpgrp(0, getpid()); - +#endif /* lose controlling tty */ if ((fd = open("/dev/tty", O_RDWR)) >= 0) { ioctl(fd, TIOCNOTTY, (char *) 0); @@ -136,7 +137,9 @@ daemonize (const char *logfile, void (*termhook)(int)) } #else /* SVR3 and older */ /* change process group */ +#ifndef __EMX__ setpgrp(); +#endif /* lose controlling tty */ signal(SIGHUP, SIG_IGN); @@ -110,12 +110,14 @@ static phase; static void set_timeout(int timeleft) /* reset the nonresponse-timeout */ { +#ifndef __EMX__ struct itimerval ntimeout; ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0; ntimeout.it_value.tv_sec = timeleft; ntimeout.it_value.tv_usec = 0; setitimer(ITIMER_REAL, &ntimeout, (struct itimerval *)NULL); +#endif } static void timeout_handler (int signal) 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); } diff --git a/fetchmail.h b/fetchmail.h index f3c3fbc9..22ab295f 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -358,6 +358,19 @@ char *showproto(int); void yyerror(const char *); int yylex(void); +#ifdef __EMX__ +void itimerthread(void*); +/* Have to include these first to avoid errors from redefining getcwd + and chdir. They're re-include protected in EMX, so it's okay, I + guess. */ +#include <stdlib.h> +#include <unistd.h> +/* Redefine getcwd and chdir to get drive-letter support so we can + find all of our lock files and stuff. */ +#define getcwd _getcwd2 +#define chdir _chdir2 +#endif + #define STRING_DISABLED (char *)-1 /* fetchmail.h ends here */ @@ -306,6 +306,7 @@ int prc_filecheck(pathname) /* check that a configuration file is secure */ const char *pathname; /* pathname for the configuration file */ { +#ifndef __EMX__ struct stat statbuf; errno = 0; @@ -342,7 +343,7 @@ const char *pathname; /* pathname for the configuration file */ fprintf(stderr, "File %s must be owned by you.\n", pathname); return(PS_AUTHFAIL); } - +#endif return(0); } |