aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--driver.c8
-rw-r--r--fetchmail.c8
-rw-r--r--fetchmail.h9
-rw-r--r--imap.c4
-rw-r--r--options.c20
-rw-r--r--rcfile_y.y8
7 files changed, 36 insertions, 26 deletions
diff --git a/NEWS b/NEWS
index 22bf9d43..bd38d6e5 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/driver.c b/driver.c
index 15c751b4..61438f91 100644
--- a/driver.c
+++ b/driver.c
@@ -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))
diff --git a/imap.c b/imap.c
index da0ed018..5fc84bc7 100644
--- a/imap.c
+++ b/imap.c
@@ -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;
diff --git a/options.c b/options.c
index 70f25848..521028ac 100644
--- a/options.c
+++ b/options.c
@@ -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:
diff --git a/rcfile_y.y b/rcfile_y.y
index e7505cbb..56195ab9 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -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);}
;
%%