diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | driver.c | 8 | ||||
-rw-r--r-- | fetchmail.c | 8 | ||||
-rw-r--r-- | fetchmail.h | 9 | ||||
-rw-r--r-- | imap.c | 4 | ||||
-rw-r--r-- | options.c | 20 | ||||
-rw-r--r-- | rcfile_y.y | 8 |
7 files changed, 36 insertions, 26 deletions
@@ -6,6 +6,7 @@ * Allow an explicit "append" option to specify what rewrite appends? (For when user's pop3 host isn't the same as his SMTP host.) * Allow -c -F to work to flush messages without retrieval. +* Read from /etc/fetchmailrc before ~/.fetchmailrc? Other TO-DO items: @@ -14,6 +15,10 @@ Release Notes: ------------------------------------------------------------------------------ +fetchmail-4.3.5 () +* Added Kent Robotti's fetchsetup configuration script. +* Corrected buggy handling of `expunge 0'. + fetchmail-4.3.4 (Fri Dec 5 12:39:31 EST 1997) * Yet another attempt on the Compuserve RPA moving target. * Fix ETRN code to poll for the fetchmail host if there's no -S option. @@ -392,7 +392,7 @@ static int smtp_open(struct query *ctl) /* try to open a socket to the appropriate SMTP server for this query */ { /* maybe it's time to close the socket in order to force delivery */ - if (ctl->batchlimit > 0 && (ctl->smtp_socket != -1) && batchcount++ == ctl->batchlimit) + if (NUM_NONZERO(ctl->batchlimit) && (ctl->smtp_socket != -1) && batchcount++ == ctl->batchlimit) { close(ctl->smtp_socket); ctl->smtp_socket = -1; @@ -1465,7 +1465,7 @@ const struct method *proto; /* protocol method table */ return(PS_SYNTAX); } } - if (!proto->getsizes && ctl->limit) + if (!proto->getsizes && NUM_SPECIFIED(ctl->limit)) { error(0, 0, "Option --limit is not supported with %s", @@ -1692,7 +1692,7 @@ const struct method *proto; /* protocol method table */ /* read, forward, and delete messages */ for (num = 1; num <= count; num++) { - flag toolarge = (ctl->limit > 0) + flag toolarge = NUM_NONZERO(ctl->limit) && msgsizes && (msgsizes[num-1] > ctl->limit); flag fetch_it = !toolarge && (ctl->fetchall || force_retrieval || !(protocol->is_old && (protocol->is_old)(sock,ctl,num))); @@ -1929,7 +1929,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 > 0 && ctl->fetchlimit <= fetches) + if (NUM_NONZERO(ctl->fetchlimit) && ctl->fetchlimit <= fetches) goto no_error; } } diff --git a/fetchmail.c b/fetchmail.c index 84f51f6a..b620467a 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -983,22 +983,22 @@ void dump_params (struct query *ctl) printf(" Nonempty Status lines will be %s (dropstatus %s)\n", ctl->dropstatus ? "discarded" : "kept", ctl->dropstatus ? "on" : "off"); - if (ctl->limit > 0) + if (NUM_NONZERO(ctl->limit)) printf(" Message size limit is %d bytes (--limit %d).\n", ctl->limit, ctl->limit); else if (outlevel == O_VERBOSE) printf(" No message size limit (--limit 0).\n"); - if (ctl->fetchlimit > 0) + if (NUM_NONZERO(ctl->fetchlimit)) printf(" Received-message limit is %d (--fetchlimit %d).\n", ctl->fetchlimit, ctl->fetchlimit); else if (outlevel == O_VERBOSE) printf(" No received-message limit (--fetchlimit 0).\n"); - if (ctl->batchlimit > 0) + if (NUM_NONZERO(ctl->batchlimit)) printf(" SMTP message batch limit is %d.\n", ctl->batchlimit); else if (outlevel == O_VERBOSE) printf(" No SMTP message batch limit (--batchlimit 0).\n"); if (ctl->server.protocol == P_IMAP) - if (ctl->expunge > 0) + if (NUM_NONZERO(ctl->expunge)) printf(" Deletion interval between expunges is %d (--expunge %d).\n", ctl->expunge, ctl->expunge); else if (outlevel == O_VERBOSE) printf(" No expunges (--expunge 0).\n"); diff --git a/fetchmail.h b/fetchmail.h index c8989a04..5fafe8bf 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -161,6 +161,15 @@ struct query struct query *next; /* next query control block in chain */ }; +/* + * Numeric option handling. Numeric option value of zero actually means + * it's unspecified. Value less than zero is zero. + */ +#define NUM_VALUE(n) (((n) == 0) ? -1 : (n)) +#define NUM_NONZERO(n) ((n) > 0) +#define NUM_ZERO(n) ((n) < 0) +#define NUM_SPECIFIED(n) ((n) != 0) + #define MULTIDROP(ctl) (ctl->wildcard || \ ((ctl)->localnames && (ctl)->localnames->next)) @@ -652,7 +652,7 @@ static int imap_delete(int sock, struct query *ctl, int number) * won't result in lots of messages being fetched again during * the next session. */ - if (ctl->expunge > 0 && (++deletions % ctl->expunge) == 0) + if (NUM_NONZERO(ctl->expunge) && (++deletions % ctl->expunge) == 0) { if ((ok = gen_transact(sock, "EXPUNGE"))) return(ok); @@ -671,7 +671,7 @@ static int imap_logout(int sock, struct query *ctl) /* send logout command */ { /* if expunges after deletion have been suppressed, ship one now */ - if (ctl->expunge == 0 && deletions) + if (NUM_SPECIFIED(ctl->expunge) && NUM_ZERO(ctl->expunge) && deletions) { int ok; @@ -276,9 +276,8 @@ struct query *ctl; /* option record to be initialized */ break; case 'l': case LA_LIMIT: - ctl->limit = atoi(optarg); - if (ctl->limit == 0) - ctl->limit = -1; + c = atoi(optarg); + ctl->limit = NUM_VALUE(c); break; case 'r': case LA_FOLDER: @@ -301,21 +300,18 @@ struct query *ctl; /* option record to be initialized */ break; case 'b': case LA_BATCHLIMIT: - ctl->batchlimit = atoi(optarg); - if (ctl->batchlimit == 0) - ctl->batchlimit = -1; + c = atoi(optarg); + ctl->batchlimit = NUM_VALUE(c); break; case 'B': case LA_FETCHLIMIT: - ctl->fetchlimit = atoi(optarg); - if (ctl->fetchlimit == 0) - ctl->fetchlimit = -1; + c = atoi(optarg); + ctl->fetchlimit = NUM_VALUE(c); break; case 'e': case LA_EXPUNGE: - ctl->expunge = atoi(optarg); - if (ctl->expunge == 0) - ctl->expunge = -1; + c = atoi(optarg); + ctl->expunge = NUM_VALUE(c); break; case 'm': case LA_MDA: @@ -245,10 +245,10 @@ user_option : TO localnames HERE | NO PASS8BITS {current.pass8bits = FLAG_FALSE;} | NO DROPSTATUS {current.dropstatus = FLAG_FALSE;} - | LIMIT NUMBER {current.limit = $2;} - | FETCHLIMIT NUMBER {current.fetchlimit = $2;} - | BATCHLIMIT NUMBER {current.batchlimit = $2;} - | EXPUNGE NUMBER {current.expunge = $2;} + | LIMIT NUMBER {current.limit = NUM_VALUE($2);} + | FETCHLIMIT NUMBER {current.fetchlimit = NUM_VALUE($2);} + | BATCHLIMIT NUMBER {current.batchlimit = NUM_VALUE($2);} + | EXPUNGE NUMBER {current.expunge = NUM_VALUE($2);} ; %% |