]> Pileus Git - ~andy/fetchmail/commitdiff
Added `set daemon'.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 13 Mar 1997 09:37:46 +0000 (09:37 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 13 Mar 1997 09:37:46 +0000 (09:37 -0000)
svn path=/trunk/; revision=930

NEWS
fetchmail.c
fetchmail.h
fetchmail.man
interface.c
options.c
rcfile_l.l
rcfile_y.y
sample.rcfile

diff --git a/NEWS b/NEWS
index 76ec5e6b66ea1c37c73a04b792cf9e69ea5a21ea..2b69af43e92df296722e2d5a31a389094328100f 100644 (file)
--- 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)
 
index 859e438e4262639898793f92d2f27ca06f583c3b..c01d255e2f01e745152434898e1c7298e1c36ed2 100644 (file)
@@ -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);
index f1edb8d7b1fd8860ead471947d826032601e239d..e2720cbc87df0eff190a46198269c563a08d3a70 100644 (file)
@@ -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 */
index b1fb6014052fba0478ba87ebf7dd090f5a802e14..cc2f72252e6f14e19e752922c072a2910ac51e51 100644 (file)
@@ -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:
 
index 189c55656e9a99d7dadbb5952878df4d5c607a7a..368eb2501f19e033a38b594507df0b6e51d8ed3a 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/ioctl.h>
 #include <netinet/in.h>
 #include <net/if.h>
+#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))
index 344e845a27eb94b29ecba97a5cd875bf3e1315c0..1361868c1718989517d21049f0401fef81163432 100644 (file)
--- 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:
index ef280e1aff9a8cd8ce1661b5e884d683fec08520..7c8591aa524c6656b7ce322623e1764a87dbc582 100644 (file)
@@ -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; }
index 199e57aa265103733c491fc944d9258f6ae298e6..658c9c57cff018bb76dd7bc8cab89dc4a44359bf 100644 (file)
@@ -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> PROTO
 %token <sval>  STRING
 %token <number> NUMBER
@@ -62,6 +62,7 @@ statement_list        : statement
 
 /* future global options should also have the form SET <name> <value> */
 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
index ded965c89713d46fc0f5f08d08b3be5d242a1423..dfc07b451b7221e9a88b03376297c26a1590f8be 100644 (file)
@@ -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