]> Pileus Git - ~andy/fetchmail/commitdiff
Implement batchlimit option.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 8 Nov 1996 05:38:41 +0000 (05:38 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 8 Nov 1996 05:38:41 +0000 (05:38 -0000)
svn path=/trunk/; revision=503

INSTALL
fetchmail.c
fetchmail.h
fetchmail.man
rcfile_l.l
rcfile_y.y
sample.rcfile

diff --git a/INSTALL b/INSTALL
index 379907c96449ff4ba4d8a7af1378ab1c5ea6869a..fb100a9f19d2e8c7bf83c77f5821a0455f80410f 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -31,7 +31,9 @@ Next run
        make
 
 This will compile fetchmail for your system.  Note that in order to
-build it, you'll need either flex at version 2.5.3 or greater, or lex.
+build it, you may find you need flex at version 2.5.3 or greater.  The
+stock lex distributed with Linux does not work -- it yields a parser
+which core-dumps on syntax errors.
 
 If mxget.c fails to compile, your DNS-query support isn't compatible
 with BSD's and Linux's.  Manually undefine HAVE_GETHOSTBYNAME in
index 9140cff5c0e266baba21230185e5df7d55c644d7..d0f04bb499f5c3faaa9328fd067ded02df0f2ba9 100644 (file)
@@ -136,13 +136,17 @@ char **argv;
 
     /* perhaps we just want to check options? */
     if (versioninfo) {
-           printf("Taking options from command line");
-           if (access(rcfile, 0))
-               printf("\n");
-           else
-               printf(" and %s\n", rcfile);
-           if (outlevel == O_VERBOSE)
-               printf("Lockfile at %s\n", tmpbuf);
+       printf("Taking options from command line");
+       if (access(rcfile, 0))
+           printf("\n");
+       else
+           printf(" and %s\n", rcfile);
+       if (outlevel == O_VERBOSE)
+           printf("Lockfile at %s\n", tmpbuf);
+       if (batchlimit)
+           printf("SMTP message batch limit is %d.\n", batchlimit);
+       else
+           printf("No SMTP message batch limit.\n");
        for (ctl = querylist; ctl; ctl = ctl->next) {
            if (ctl->active && !(implicitmode && ctl->skip))
                dump_params(ctl);
@@ -667,9 +671,7 @@ struct query *ctl;  /* query parameter block */
                && ctl->authenticate == A_KERBEROS)
        printf("  Protocol is KPOP");
     else
-    {
        printf("  Protocol is %s", showproto(ctl->protocol));
-    }
     if (ctl->port)
        printf(" (using port %d)", ctl->port);
     else if (outlevel == O_VERBOSE)
index 3b0973fcc53e1d1f891d626a1a725feaf85f85ab..49fa1ee187c40882a4a3236f2adc59ae0022458e 100644 (file)
@@ -138,6 +138,7 @@ extern int nodetach;                /* if TRUE, don't detach daemon process */
 extern char *logfile;          /* log file for daemon mode */
 extern int quitmode;           /* if --quit was set */
 extern int check_only;         /* if --check was set */
+extern int batchlimit;         /* if --batchlimit was set */
 
 /* miscellaneous global controls */
 extern char *rcfile;           /* path name of rc file */
@@ -196,7 +197,7 @@ char *getpassword(char *);
 
 void escapes(const char *, char *);
 
-void yyerror(const char *);
+void yyerror(char *);
 int yylex();
 
 #else
index 1373840b38151ca36032caaab09f14a5dc72ed17..c8e9d6db8ae91c081410d712edc2463f5b4ac302 100644 (file)
@@ -189,6 +189,18 @@ provided to pacify people who are paranoid about having an MTA edit
 mail headers and want to know they can prevent it, but it is generally
 not a good idea to actually turn off rewrite.)
 .TP
+.B -b, --batchlimit
+Specify the maximum number of messages that will be shipped to an SMTP
+listener before the connection is deliberately torn down and rebuilt
+(defaults to 0, meaning no limit).  While \fBsendmail\fR(8) normally
+initiates delivery of a message immediately after receiving the
+message terminator, some SMTP listeners are not so prompt.  MTAs like
+\fIqmail\fR(8) and \fsmail\fR(8) will wait till the delivery socket is
+shut down to deliver.  This may produce annoying delays when
+.IR fetchmail (8)
+is processing very large batches.  Setting the batch limit to some
+nonzero size will prevent these delays.
+.TP
 .B \-V, --version
 Displays the version information for your copy of 
 .I fetchmail.
@@ -388,7 +400,9 @@ be executed when
 is called with no arguments.
 .PP
 Comments begin with a '#' and extend through the end of the line.
-Otherwise the file consists of a series of free-format server entries.
+Otherwise the file consists of a series of free-format server entries
+or global option statement.
+.PP
 Any amount of whitespace separates keywords, tokens, or strings in
 server entries, but is otherwise ignored (except that whitespace
 enclosed in double quotes is treated as part of the string).  Keywords
@@ -495,6 +509,11 @@ or reverse it by saying `user esr here is eric there'
 .PP
 For backward compatibility, the word `server' is a syninym for `poll'.
 .PP
+There is currently only one valid global option statement; it is 
+\&`set batchlimit = ' followed by a number and sets the same global
+specified by the --batchlimit option.  (The command line option
+can override this.)
+.PP
 Basic format is:
 
 .nf
index 29e097cc75d5ed88ea5b0b227f53443e29dc5dd3..4a16a0f8c62a3be1cbb95ebf7f1f2639da804e1b 100644 (file)
 int prc_lineno = 1;
 %}
 
-%o 4000
+/* this doesn't work with Linux lex, see the INSTALL file */
+%o 5000
+%a 2100
 
 %%
 
+set            { return SET; }
+batchlimit     { return BATCHLIMIT; }
 defaults       { return DEFAULTS; }
 server                 { return POLL; }
 poll           { return POLL; }
index d41cecc3b81bb367be54d1634912fdf48597da80..5cbbc3316bc3e39faa4b7036f9bb37be2de52bd9 100644 (file)
@@ -43,6 +43,7 @@ static void prc_reset();
 
 %token DEFAULTS POLL PROTOCOL AUTHENTICATE TIMEOUT KPOP KERBEROS
 %token USERNAME PASSWORD FOLDER SMTPHOST MDA IS HERE THERE TO MAP LIMIT
+%token SET BATCHLIMIT 
 %token <proto> PROTO
 %token <sval>  STRING
 %token <number> NUMBER
@@ -62,7 +63,9 @@ statement_list        : statement
                | statement_list statement
                ;
 
-statement      : define_server serverspecs userspecs      
+/* future global options should also have the form SET <name> <value> */
+statement      : define_server serverspecs userspecs
+               | SET BATCHLIMIT MAP NUMBER     {batchlimit = $4;}
                ;
 
 define_server  : POLL STRING   {strcpy(current.servername, $2);}
@@ -152,10 +155,10 @@ static struct query *hosttail;    /* where to add new elements */
 
 void yyerror (s)
 /* report a syntax error */
-const char *s; /* error string */
+char *s;       /* error string */
 {
-  fprintf(stderr,"%s line %d: %s at %s\n", rcfile, prc_lineno, s, yytext);
-  prc_errflag++;
+    fprintf(stderr,"%s line %d: %s at %s\n", rcfile, prc_lineno, s, yytext);
+    prc_errflag++;
 }
 
 int prc_filecheck(pathname)
index 5ade67b25aa11f48e40b5139fffa7c15f3004909..1f2f58fcc1b0036e125481b13ef8967a8a8b8be6 100644 (file)
 #   login
 #   kerberos
 #
+# Legal global option statements are
+#
+#   set batchlimit =           -- 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
 # punctuation charactes `,' `:' `;' are also ignored. 
@@ -61,6 +65,8 @@
 # 
 # This is what the developer's .fetchmailrc looks like:
 
+set batchlimit 0       # I forward to sendmail
+
 defaults password not_blowing_my_cover;
 
 # Use this for production