aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-09 16:42:00 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-09 16:42:00 +0000
commit30041d963fb87fee22d9e13dad96e9699d33d4e3 (patch)
tree97d811736ad0eab32764f7050db98df4a634f401
parent2b4f2b8e3843c57895b8f7ef96add7430a49e06a (diff)
downloadfetchmail-30041d963fb87fee22d9e13dad96e9699d33d4e3.tar.gz
fetchmail-30041d963fb87fee22d9e13dad96e9699d33d4e3.tar.bz2
fetchmail-30041d963fb87fee22d9e13dad96e9699d33d4e3.zip
Arrange for command-line set of batchlimit.
svn path=/trunk/; revision=525
-rw-r--r--fetchmail.c5
-rw-r--r--fetchmail.h3
-rw-r--r--options.c16
3 files changed, 20 insertions, 4 deletions
diff --git a/fetchmail.c b/fetchmail.c
index e22568a5..eabef1d0 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -43,6 +43,7 @@ int nodetach; /* if TRUE, don't detach daemon process */
char *logfile; /* log file for daemon mode */
int quitmode; /* if --quit was set */
int check_only; /* if --probe was set */
+int cmd_batchlimit; /* if --batchlimit was set */
/* miscellaneous global controls */
char *rcfile; /* path name of rc file */
@@ -559,6 +560,10 @@ static int load_params(int argc, char **argv, int optind)
else
initialize_saved_lists(querylist, idfile);
+ /* if cmd_batchlimit was explicitly set, use it to override batchlimit */
+ if (cmd_batchlimit > -1)
+ batchlimit = cmd_batchlimit;
+
return(implicitmode);
}
diff --git a/fetchmail.h b/fetchmail.h
index 9bdc6e96..6dd5f115 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -138,6 +138,9 @@ 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 cmd_batchlimit; /* if --batchlimit was set */
+
+/* these get computed */
extern int batchlimit; /* if --batchlimit was set */
extern int batchcount; /* count of messages sent in current batch */
diff --git a/options.c b/options.c
index fd6be6f2..d557fc88 100644
--- a/options.c
+++ b/options.c
@@ -40,10 +40,11 @@
#define LA_LIMIT 22
#define LA_REMOTEFILE 23
#define LA_SMTPHOST 24
-#define LA_MDA 25
-#define LA_YYDEBUG 26
+#define LA_BATCHLIMIT 25
+#define LA_MDA 26
+#define LA_YYDEBUG 27
-static char *shortoptions = "?Vcsvd:NqL:f:i:p:P:A:t:u:akKFnl:r:S:m:y";
+static char *shortoptions = "?Vcsvd:NqL:f:i:p:P:A:t:u:akKFnl:r:S:b:m:y";
static struct option longoptions[] = {
{"help", no_argument, (int *) 0, LA_HELP },
{"version", no_argument, (int *) 0, LA_VERSION },
@@ -75,6 +76,7 @@ static struct option longoptions[] = {
{"remote", required_argument, (int *) 0, LA_REMOTEFILE },
{"smtphost", required_argument, (int *) 0, LA_SMTPHOST },
+ {"batchlimit",required_argument, (int *) 0, LA_BATCHLIMIT },
{"mda", required_argument, (int *) 0, LA_MDA },
{"yydebug", no_argument, (int *) 0, LA_YYDEBUG },
@@ -82,7 +84,7 @@ static struct option longoptions[] = {
{(char *) 0, no_argument, (int *) 0, 0 }
};
-int parsecmdline (argc, argv,ctl)
+int parsecmdline (argc, argv, ctl)
/* parse and validate the command line options */
int argc; /* argument count */
char **argv; /* argument strings */
@@ -102,6 +104,7 @@ struct query *ctl; /* option record to be initialized */
int option_index;
memset(ctl, '\0', sizeof(struct query)); /* start clean */
+ cmd_batchlimit = -1;
while (!errflag &&
(c = getopt_long(argc,argv,shortoptions,
@@ -229,6 +232,10 @@ struct query *ctl; /* option record to be initialized */
strncpy(ctl->smtphost,optarg,sizeof(ctl->smtphost)-1);
ocount++;
break;
+ case 'b':
+ case LA_BATCHLIMIT:
+ cmd_batchlimit = atoi(optarg);
+ break;
case 'm':
case LA_MDA:
strncpy(ctl->mda,optarg,sizeof(ctl->mda));
@@ -283,6 +290,7 @@ struct query *ctl; /* option record to be initialized */
fputs(" -l, --limit don't fetch messages over given size\n", stderr);
fputs(" -S, --smtphost set SMTP forwarding host\n", stderr);
+ fputs(" -b, --batchlimit set batch limit for SMTP connections\n", stderr);
fputs(" -r, --remote specify remote folder name\n", stderr);
return(-1);
}