aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-08 05:38:41 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-08 05:38:41 +0000
commit4cf99da5da3d1e2d54cf2ac81c0dfd5bf94ca98a (patch)
tree9f0555eab9627e9c6f168fc3bba971de32cffda2
parent995f32756f7c222468bb3527ae6b9f340fe333ea (diff)
downloadfetchmail-4cf99da5da3d1e2d54cf2ac81c0dfd5bf94ca98a.tar.gz
fetchmail-4cf99da5da3d1e2d54cf2ac81c0dfd5bf94ca98a.tar.bz2
fetchmail-4cf99da5da3d1e2d54cf2ac81c0dfd5bf94ca98a.zip
Implement batchlimit option.
svn path=/trunk/; revision=503
-rw-r--r--INSTALL4
-rw-r--r--fetchmail.c20
-rw-r--r--fetchmail.h3
-rw-r--r--fetchmail.man21
-rw-r--r--rcfile_l.l6
-rw-r--r--rcfile_y.y11
-rw-r--r--sample.rcfile6
7 files changed, 54 insertions, 17 deletions
diff --git a/INSTALL b/INSTALL
index 379907c9..fb100a9f 100644
--- 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
diff --git a/fetchmail.c b/fetchmail.c
index 9140cff5..d0f04bb4 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -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)
diff --git a/fetchmail.h b/fetchmail.h
index 3b0973fc..49fa1ee1 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -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
diff --git a/fetchmail.man b/fetchmail.man
index 1373840b..c8e9d6db 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -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
diff --git a/rcfile_l.l b/rcfile_l.l
index 29e097cc..4a16a0f8 100644
--- a/rcfile_l.l
+++ b/rcfile_l.l
@@ -13,10 +13,14 @@
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; }
diff --git a/rcfile_y.y b/rcfile_y.y
index d41cecc3..5cbbc331 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -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)
diff --git a/sample.rcfile b/sample.rcfile
index 5ade67b2..1f2f58fc 100644
--- a/sample.rcfile
+++ b/sample.rcfile
@@ -52,6 +52,10 @@
# 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