Commit 4cf99da5 authored by Eric S. Raymond's avatar Eric S. Raymond

Implement batchlimit option.

svn path=/trunk/; revision=503
parent 995f3275
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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; }
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment