From fde28f60a7cc6f1cac487b0365e2a2be1fb59f49 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 13 Mar 1997 09:37:46 +0000 Subject: [PATCH] Added `set daemon'. svn path=/trunk/; revision=930 --- NEWS | 19 +++++++++++++++---- fetchmail.c | 10 ++++++++++ fetchmail.h | 1 + fetchmail.man | 7 +++++-- interface.c | 3 ++- options.c | 4 +++- rcfile_l.l | 5 +++-- rcfile_y.y | 3 ++- sample.rcfile | 3 +++ 9 files changed, 44 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 76ec5e6b..2b69af43 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,15 @@ timeouts really broken? We must find a way to test this.) Release Notes: +------------------------------------------------------------------------------ +fetchmail-3.9 () + +features -- + +* It is now possible to set a default poll interval with `set daemon'. + +There are 249 people on the fetchmail-friends list. + ------------------------------------------------------------------------------ fetchmail-3.8 (Fri Mar 7 17:34:02 EST 1997) @@ -45,20 +54,22 @@ features -- * More FAQ material on using `localdomains'. -* compilation hacks for ISC 4.0 (thanks, Larry Jones!). +* Compilation hacks for ISC 4.0 (thanks, Larry Jones!). bugs -- -* enabled ETRN and RPOP command-line options. +* Enabled ETRN and RPOP command-line options. -* yet another attempt to fix the error.c compilation problems under +* Yet another attempt to fix the error.c compilation problems under Solaris and NEXTSTEP. -* handle \( and \) correctly in RFC822 comments, thanks to Gareth McCaughan. +* Handle \( and \) correctly in RFC822 comments, thanks to Gareth McCaughan. * Fixed off-by-one error fingered by Brian Jones that prevented `localdomains' from working. +There are 248 people on the fetchmail-friends list. + ------------------------------------------------------------------------------ fetchmail-3.7 (Fri Feb 21 17:38:40 EST 1997) diff --git a/fetchmail.c b/fetchmail.c index 859e438e..c01d255e 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -59,6 +59,7 @@ int use_syslog; /* if --syslog was set */ int quitmode; /* if --quit was set */ int check_only; /* if --probe was set */ char *cmd_logfile; /* if --logfile was set */ +int cmd_daemon; /* if --daemon was set */ /* miscellaneous global controls */ char *rcfile; /* path name of rc file */ @@ -665,6 +666,10 @@ static int load_params(int argc, char **argv, int optind) if (cmd_logfile) logfile = cmd_logfile; + /* likewise for poll_interval */ + if (cmd_daemon >= 0) + poll_interval = cmd_daemon; + return(implicitmode); } @@ -767,6 +772,11 @@ void dump_params (struct query *ctl) { printf("Options for retrieving from %s@%s:\n", ctl->remotename, visbuf(ctl->server.names->id)); + + if (logfile) + printf(" Logfile is %s\n", logfile); + if (poll_interval) + printf(" Poll interval is %d seconds\n", poll_interval); #ifdef HAVE_GETHOSTBYNAME if (ctl->server.canonical_name) printf(" Canonical DNS name of server is %s.\n", ctl->server.canonical_name); diff --git a/fetchmail.h b/fetchmail.h index f1edb8d7..e2720cbc 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -167,6 +167,7 @@ extern int use_syslog; /* if --syslog was set */ extern int quitmode; /* if --quit was set */ extern int check_only; /* if --check was set */ extern char *cmd_logfile; /* if --logfile was set */ +extern int cmd_daemon; /* if --daemon was set */ /* these get computed */ extern int batchcount; /* count of messages sent in current batch */ diff --git a/fetchmail.man b/fetchmail.man index b1fb6014..cc2f7225 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -729,9 +729,12 @@ or reverse it by saying `user esr here is eric there' .PP For backward compatibility, the word `server' is a synonym for `poll'. .PP -There is currently just one global option statement; `set logfile = ' +There are currently two global option statements; `set logfile = ' followed by a string sets the same global specified by --logfile. A -command-line --logfile option will override this. +command-line --logfile option will override this. Also, `set daemon' +sets the poll interval as --daemon does. This can be overridden by +a command-line --daemon option; iin particular --daemon 0 can be used +to force foreground operation. .PP Basic format is: diff --git a/interface.c b/interface.c index 189c5565..368eb250 100644 --- a/interface.c +++ b/interface.c @@ -24,6 +24,7 @@ #include #include #include +#include "config.h" #include "fetchmail.h" typedef struct { @@ -121,7 +122,7 @@ void interface_parse(char *buf, struct hostdata *hp) *cp2++ = '\000'; /* convert IP address and netmask */ - hp->interface_pair = xmalloc(sizeof(struct interface_pair_s)); + hp->interface_pair = (struct interface_pair_s *)xmalloc(sizeof(struct interface_pair_s)); if (!inet_aton(cp1, &hp->interface_pair->interface_address)) (void) error(PS_SYNTAX, 0, "invalid IP interface address"); if (!inet_aton(cp2, &hp->interface_pair->interface_mask)) diff --git a/options.c b/options.c index 344e845a..1361868c 100644 --- a/options.c +++ b/options.c @@ -116,6 +116,8 @@ struct query *ctl; /* option record to be initialized */ int errflag = 0; /* TRUE when a syntax error is detected */ int option_index; + cmd_daemon = -1; + memset(ctl, '\0', sizeof(struct query)); /* start clean */ while (!errflag && @@ -141,7 +143,7 @@ struct query *ctl; /* option record to be initialized */ break; case 'd': case LA_DAEMON: - poll_interval = atoi(optarg); + cmd_daemon = atoi(optarg); break; case 'N': case LA_NODETACH: diff --git a/rcfile_l.l b/rcfile_l.l index ef280e1a..7c8591aa 100644 --- a/rcfile_l.l +++ b/rcfile_l.l @@ -23,8 +23,7 @@ set { return SET; } batchlimit { return BATCHLIMIT; } fetchlimit { return FETCHLIMIT; } logfile { return LOGFILE; } -interface { return INTERFACE; } -monitor { return MONITOR; } +daemon { return DAEMON; } defaults { return DEFAULTS; } server { return POLL; } @@ -45,6 +44,8 @@ remote(folder)? { return FOLDER; } smtp(host)? { return SMTPHOST; } mda { return MDA; } pre(connect) { return PRECONNECT; } +interface { return INTERFACE; } +monitor { return MONITOR; } is { return IS; } here { return HERE; } diff --git a/rcfile_y.y b/rcfile_y.y index 199e57aa..658c9c57 100644 --- a/rcfile_y.y +++ b/rcfile_y.y @@ -44,7 +44,7 @@ static void user_reset(); %token AUTHENTICATE TIMEOUT KPOP KERBEROS %token ENVELOPE USERNAME PASSWORD FOLDER SMTPHOST MDA PRECONNECT LIMIT %token IS HERE THERE TO MAP WILDCARD -%token SET BATCHLIMIT FETCHLIMIT LOGFILE INTERFACE MONITOR +%token SET BATCHLIMIT FETCHLIMIT LOGFILE DAEMON INTERFACE MONITOR %token PROTO %token STRING %token NUMBER @@ -62,6 +62,7 @@ statement_list : statement /* future global options should also have the form SET */ statement : SET LOGFILE MAP STRING {logfile = xstrdup($4);} + | SET DAEMON NUMBER {poll_interval = $3;} /* * The way the next two productions are written depends on the fact that diff --git a/sample.rcfile b/sample.rcfile index ded965c8..dfc07b45 100644 --- a/sample.rcfile +++ b/sample.rcfile @@ -72,6 +72,7 @@ # Legal global option statements are # # set logfile = -- must be followed by a string +# set daemon = -- must be followed by a number # # The noise keywords `and', `with', `has', `wants', and `options' are ignored # anywhere in an entry; they can be used to make it resemble English. The @@ -82,6 +83,8 @@ # # This is what the developer's .fetchmailrc looks like: +set daemon 300 # Poll at 5-minute intervals + defaults interface "sl0/10.0.2.15" # SLIRP standard address user esr is esr fetchmail-friends magic-numbers here -- 2.43.2