aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-02-22 16:45:08 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-02-22 16:45:08 +0000
commit869865269995d67e5c30f45393e83eeee5229647 (patch)
tree2bd23d0a2d62c92e28b6b8589f21848a9404f306
parentd8e3aad2c36043d83d9ddc6af71a4724d3433096 (diff)
downloadfetchmail-869865269995d67e5c30f45393e83eeee5229647.tar.gz
fetchmail-869865269995d67e5c30f45393e83eeee5229647.tar.bz2
fetchmail-869865269995d67e5c30f45393e83eeee5229647.zip
EMX changes for OS/2.
svn path=/trunk/; revision=1668
-rw-r--r--NEWS1
-rw-r--r--daemon.c5
-rw-r--r--driver.c2
-rw-r--r--fetchmail.c22
-rw-r--r--fetchmail.h13
-rw-r--r--rcfile_y.y3
6 files changed, 43 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 459030ab..c6c9c3e0 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/daemon.c b/daemon.c
index 5c66ed5a..e7b9214b 100644
--- a/daemon.c
+++ b/daemon.c
@@ -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);
diff --git a/driver.c b/driver.c
index 8c0657c2..e6e44e6d 100644
--- a/driver.c
+++ b/driver.c
@@ -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 */
diff --git a/rcfile_y.y b/rcfile_y.y
index b704c2ce..4ea4f866 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -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);
}