diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-12-24 20:00:28 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-12-24 20:00:28 +0000 |
commit | bc0ba46bc4b30dff8459ab55b2c107838558476f (patch) | |
tree | 447cc20f0c4d0f17a250c2f46c11c6573a5e8520 /fetchmail.c | |
parent | c844c9b1341d92c81f71d5e3bd1aae5c9faa3c89 (diff) | |
download | fetchmail-bc0ba46bc4b30dff8459ab55b2c107838558476f.tar.gz fetchmail-bc0ba46bc4b30dff8459ab55b2c107838558476f.tar.bz2 fetchmail-bc0ba46bc4b30dff8459ab55b2c107838558476f.zip |
George Sipe's patch.
svn path=/trunk/; revision=684
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 102 |
1 files changed, 53 insertions, 49 deletions
diff --git a/fetchmail.c b/fetchmail.c index 722ddcf7..bea98e7e 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -167,14 +167,16 @@ int main (int argc, char **argv) printf("SMTP message batch limit is %d.\n", batchlimit); else if (outlevel == O_VERBOSE) printf("No SMTP message batch limit.\n"); +#ifdef linux if (interface) - printf("TCP/IP interface is %s.\n", interface); + printf("TCP/IP interface requirements for %s.\n", interface); else if (outlevel == O_VERBOSE) - printf("No TCP/IP interface specified\n"); + printf("No TCP/IP interface requirements specified\n"); if (monitor) printf("Polling loop will monitor %s.\n", monitor); else if (outlevel == O_VERBOSE) - printf("No monitor address specified\n"); + printf("No monitor interface specified\n"); +#endif for (ctl = querylist; ctl; ctl = ctl->next) { if (ctl->active && !(implicitmode && ctl->skip)) dump_params(ctl); @@ -334,6 +336,54 @@ int main (int argc, char **argv) * reflect the status of that transaction. */ do { + if (poll_interval) + { + if (outlevel == O_VERBOSE) + { + time_t now; + + time(&now); + fprintf(stderr, "fetchmail: sleeping at %s", ctime(&now)); + } + + /* + * We can't use sleep(3) here because we need an alarm(3) + * equivalent in order to implement server nonresponse timeout. + * We'll just assume setitimer(2) is available since fetchmail + * has to have a BSDoid socket layer to work at all. + */ +#ifdef linux + do { + interface_note_activity(); +#endif + { + struct itimerval ntimeout; + + ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0; + ntimeout.it_value.tv_sec = poll_interval; + ntimeout.it_value.tv_usec = 0; + + setitimer(ITIMER_REAL,&ntimeout,NULL); + signal(SIGALRM, donothing); + pause(); + if (lastsig == SIGUSR1) { + signal(SIGALRM, SIG_IGN); + (void) error(0, 0, "awakened by SIGUSR1"); + } + } +#ifdef linux + } while (!interface_approve()); +#endif + + if (outlevel == O_VERBOSE) + { + time_t now; + + time(&now); + fprintf(stderr, "fetchmail: awakened at %s", ctime(&now)); + } + } + #ifdef HAVE_RES_SEARCH sethostent(TRUE); /* use TCP/IP for mailserver queries */ #endif /* HAVE_RES_SEARCH */ @@ -405,52 +455,6 @@ int main (int argc, char **argv) fclose(ctl->smtp_sockfp); ctl->smtp_sockfp = (FILE *)NULL; } - - if (poll_interval) - { - if (outlevel == O_VERBOSE) - { - time_t now; - - time(&now); - fprintf(stderr, "fetchmail: sleeping at %s", ctime(&now)); - } - - /* - * We can't use sleep(3) here because we need an alarm(3) - * equivalent in order to implement server nonresponse timeout. - * We'll just assume setitimer(2) is available since fetchmail - * has to have a BSDoid socket layer to work at all. - */ -#ifdef linux - do { - interface_note_activity(); -#endif - { - struct itimerval ntimeout; - - ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0; - ntimeout.it_value.tv_sec = poll_interval; - ntimeout.it_value.tv_usec = 0; - - setitimer(ITIMER_REAL,&ntimeout,NULL); - signal(SIGALRM, donothing); - pause(); - if (lastsig == SIGUSR1) - (void) error(0, 0, "awakened by SIGUSR1"); - } -#ifdef linux - } while (!interface_approve()); -#endif - - if (outlevel == O_VERBOSE) - { - time_t now; - - time(&now); - fprintf(stderr, "fetchmail: awakened at %s", ctime(&now)); - } - } } while (poll_interval); |