From 1db4207a5ffdc53bbc7cbaffe8d6f0b20bd9b030 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 11 Jun 1997 16:07:37 +0000 Subject: Put in Dave Holland's feature. svn path=/trunk/; revision=1089 --- NEWS | 12 +++++------- driver.c | 13 +++++++------ fetchmail.c | 7 ++++++- fetchmail.man | 25 ++++++++++++++----------- options.c | 8 ++++++++ 5 files changed, 40 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index d4a344dd..560cd37f 100644 --- a/NEWS +++ b/NEWS @@ -6,11 +6,6 @@ Features To Consider -* Dave Holland thinks it's a misfeature that - --fetchall overrides --limit. He may have a point. Perhaps I should - re-code this so --limit is still operative with --fetchall on, but you - can turn off the size limit with --limit 0. - * Generate bounce messages when delivery is refused. See RFC1891, RFC1894. * More log levels? @@ -24,11 +19,14 @@ fetchmail-4.0 (): * Fetchmail is now normally built with optimization. * POP2 support is no longer compiled by default, but you can configure it in with `configure --enable-POP2'. -* Architecture-independent RPM building. * If a .fetchmailrc entry has multiple user parts, the opening `username' keyword is now required for all. +* Fetchall no longer overrides --limit. +* Values of --limit, --fetchlimit, and --batchlimit in .fetchmailrc can now + be overridden from the command line by specifying an explicit option of 0. +* Architecture-independent RPM building. -There are 256 people on the fetchmail-friends list. +There are 257 people on the fetchmail-friends list. pl 3.9.7 (Mon Jun 9 18:40:04 EDT 1997): * Complain and exit if user tries to start fetchmail with options while a diff --git a/driver.c b/driver.c index 20dd4a49..46cd22ae 100644 --- a/driver.c +++ b/driver.c @@ -360,7 +360,7 @@ int smtp_open(struct query *ctl) struct idlist *idp; /* maybe it's time to close the socket in order to force delivery */ - if (ctl->batchlimit && (ctl->smtp_socket != -1) && batchcount++ == ctl->batchlimit) + if (ctl->batchlimit > 0 && (ctl->smtp_socket != -1) && batchcount++ == ctl->batchlimit) { close(ctl->smtp_socket); ctl->smtp_socket = -1; @@ -1401,7 +1401,7 @@ const struct method *proto; /* protocol method table */ * remove the `&& ctl->limit' here. */ msgsizes = (int *)NULL; - if (!ctl->fetchall && proto->getsizes && ctl->limit) + if (proto->getsizes && ctl->limit > 0) { msgsizes = (int *)alloca(sizeof(int) * count); @@ -1449,9 +1449,10 @@ const struct method *proto; /* protocol method table */ /* read, forward, and delete messages */ for (num = 1; num <= count; num++) { - bool toolarge = msgsizes && (msgsizes[num-1] > ctl->limit); - bool fetch_it = ctl->fetchall || - (!toolarge && (force_retrieval || !(protocol->is_old && (protocol->is_old)(sock,ctl,num)))); + bool toolarge = (ctl->limit > 0) + && msgsizes && (msgsizes[num-1] > ctl->limit); + bool fetch_it = !toolarge + && (ctl->fetchall || force_retrieval || !(protocol->is_old && (protocol->is_old)(sock,ctl,num))); bool suppress_delete = FALSE; bool suppress_forward = FALSE; @@ -1624,7 +1625,7 @@ const struct method *proto; /* protocol method table */ error_complete(0, 0, " not flushed"); /* perhaps this as many as we're ready to handle */ - if (ctl->fetchlimit && ctl->fetchlimit <= fetches) + if (ctl->fetchlimit > 0 && ctl->fetchlimit <= fetches) goto no_error; } } diff --git a/fetchmail.c b/fetchmail.c index 4e128686..a6a3a5b5 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -661,6 +661,10 @@ static int load_params(int argc, char **argv, int optind) if (!ctl->mailboxes) save_str(&ctl->mailboxes, -1, (char *)NULL); + /* maybe user overrode timeout on command line? */ + if (ctl->server.timeout == -1) + ctl->server.timeout = CLIENT_TIMEOUT; + /* sanity checks */ if (ctl->server.port < 0) { @@ -873,7 +877,8 @@ void dump_params (struct query *ctl) putchar('\n'); if (ctl->server.preauthenticate == A_KERBEROS_V4) printf(" Kerberos V4 preauthentication enabled.\n"); - printf(" Server nonresponse timeout is %d seconds", ctl->server.timeout); + if (ctl->server.timeout > 0) + printf(" Server nonresponse timeout is %d seconds", ctl->server.timeout); if (ctl->server.timeout == CLIENT_TIMEOUT) printf(" (default).\n"); else diff --git a/fetchmail.man b/fetchmail.man index cf50667c..777f5c08 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -199,20 +199,22 @@ down upon your head. Takes a maximum octet size argument. Messages larger than this size will not be fetched, not be marked seen, and will be left on the server (in foreground sessions, the progress messages will note that -they are "oversized"). The --all option overrides this one. This -option is intended for those needing to strictly control fetch time -in interactive mode. It may not be used with daemon mode, -as users would never receive a notification that messages were waiting. -This option does not work with ETRN. +they are "oversized"). An explicit --limit of 0 overrides any limits set +in your run control file. This option is intended for those needing to +strictly control fetch time in interactive mode. It may not be used +with daemon mode, as users would never receive a notification that +messages were waiting. This option does not work with ETRN. .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 \fIsmail\fR(8) may wait till the delivery socket is -shut down to deliver. This may produce annoying delays when +(defaults to 0, meaning no limit). An explicit --batchlimit of 0 +overrides any limits set in your run control file. 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 \fIsmail\fR(8) may 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. @@ -220,7 +222,8 @@ This option does not work with ETRN. .TP .B -B, --fetchlimit Limit the number of messages accepted from a given server in a single -poll. By default there is no limit. +poll. By default there is no limit. An explicit --fetchlimit of 0 +overrides any limits set in your run control file. .SS Authentication Options .TP .B \-u name, --username name diff --git a/options.c b/options.c index 0241ca57..ff932f96 100644 --- a/options.c +++ b/options.c @@ -225,6 +225,8 @@ struct query *ctl; /* option record to be initialized */ case 't': case LA_TIMEOUT: ctl->server.timeout = atoi(optarg); + if (ctl->server.timeout == 0) + ctl->server.timeout = -1; break; case 'E': case LA_ENVELOPE: @@ -258,6 +260,8 @@ struct query *ctl; /* option record to be initialized */ case 'l': case LA_LIMIT: ctl->limit = atoi(optarg); + if (ctl->limit == 0) + ctl->limit = -1; break; case 'r': case LA_FOLDER: @@ -281,10 +285,14 @@ struct query *ctl; /* option record to be initialized */ case 'b': case LA_BATCHLIMIT: ctl->batchlimit = atoi(optarg); + if (ctl->batchlimit == 0) + ctl->batchlimit = -1; break; case 'B': case LA_FETCHLIMIT: ctl->fetchlimit = atoi(optarg); + if (ctl->fetchlimit == 0) + ctl->fetchlimit = -1; break; case 'm': case LA_MDA: -- cgit v1.2.3