]> Pileus Git - ~andy/fetchmail/blob - options.c
Fix typo: --sslcertck checks the /server/ certificate (not the client's).
[~andy/fetchmail] / options.c
1 /*
2  * options.c -- command-line option processing
3  *
4  * Copyright 1998 by Eric S. Raymond.
5  * For license terms, see the file COPYING in this directory.
6  */
7
8 #include "config.h"
9
10 #include <stdio.h>
11 #include <pwd.h>
12 #include <string.h>
13 #include <errno.h>
14 #if defined(STDC_HEADERS)
15 #include  <stdlib.h>
16 #include  <limits.h>
17 #else
18 #include  <ctype.h>
19 #endif
20
21 #include "getopt.h"
22 #include "fetchmail.h"
23 #include "i18n.h"
24
25 enum {
26     LA_INVISIBLE = 256,
27     LA_SYSLOG,
28     LA_NOSYSLOG,
29     LA_POSTMASTER,
30     LA_NOBOUNCE,
31     LA_AUTH,
32     LA_FETCHDOMAINS,
33     LA_BSMTP,
34     LA_LMTP,
35     LA_PLUGIN,
36     LA_PLUGOUT,
37     LA_CONFIGDUMP,
38     LA_SMTPNAME,
39     LA_SHOWDOTS,
40     LA_PRINCIPAL,
41     LA_TRACEPOLLS,
42     LA_SSL,
43     LA_SSLKEY,
44     LA_SSLCERT,
45     LA_SSLPROTO,
46     LA_SSLCERTCK,
47     LA_SSLCERTPATH,
48     LA_SSLFINGERPRINT,
49     LA_FETCHSIZELIMIT,
50     LA_FASTUIDL,
51     LA_LIMITFLUSH,
52 };
53
54 /* options still left: CgGhHjJoORTWxXYz */
55 static const char *shortoptions = 
56         "?Vcsvd:NqL:f:i:p:UP:A:t:E:Q:u:akKFnl:r:S:Z:b:B:e:m:I:M:yw:D:";
57
58 static const struct option longoptions[] = {
59 /* this can be const because all flag fields are 0 and will never get set */
60   {"help",      no_argument,       (int *) 0, '?' },
61   {"version",   no_argument,       (int *) 0, 'V' },
62   {"check",     no_argument,       (int *) 0, 'c' },
63   {"silent",    no_argument,       (int *) 0, 's' },
64   {"verbose",   no_argument,       (int *) 0, 'v' },
65   {"daemon",    required_argument, (int *) 0, 'd' },
66   {"nodetach",  no_argument,       (int *) 0, 'N' },
67   {"quit",      no_argument,       (int *) 0, 'q' },
68   {"logfile",   required_argument, (int *) 0, 'L' },
69   {"invisible", no_argument,       (int *) 0, LA_INVISIBLE },
70   {"showdots",  no_argument,       (int *) 0, LA_SHOWDOTS },
71   {"syslog",    no_argument,       (int *) 0, LA_SYSLOG },
72   {"nosyslog",  no_argument,       (int *) 0, LA_NOSYSLOG },
73   {"fetchmailrc",required_argument,(int *) 0, 'f' },
74   {"idfile",    required_argument, (int *) 0, 'i' },
75   {"postmaster",required_argument, (int *) 0, LA_POSTMASTER },
76   {"nobounce",  no_argument,       (int *) 0, LA_NOBOUNCE },
77
78   {"protocol",  required_argument, (int *) 0, 'p' },
79   {"proto",     required_argument, (int *) 0, 'p' },
80   {"uidl",      no_argument,       (int *) 0, 'U' },
81   {"port",      required_argument, (int *) 0, 'P' },
82   {"service",   required_argument, (int *) 0, 'P' },
83   {"auth",      required_argument, (int *) 0, LA_AUTH},
84   {"timeout",   required_argument, (int *) 0, 't' },
85   {"envelope",  required_argument, (int *) 0, 'E' },
86   {"qvirtual",  required_argument, (int *) 0, 'Q' },
87
88   {"user",      required_argument, (int *) 0, 'u' },
89   {"username",  required_argument, (int *) 0, 'u' },
90
91   {"all",       no_argument,       (int *) 0, 'a' },
92   {"nokeep",    no_argument,       (int *) 0, 'K' },
93   {"keep",      no_argument,       (int *) 0, 'k' },
94   {"flush",     no_argument,       (int *) 0, 'F' },
95   {"limitflush",        no_argument, (int *) 0, LA_LIMITFLUSH },
96   {"norewrite", no_argument,       (int *) 0, 'n' },
97   {"limit",     required_argument, (int *) 0, 'l' },
98   {"warnings",  required_argument, (int *) 0, 'w' },
99
100   {"folder",    required_argument, (int *) 0, 'r' },
101   {"smtphost",  required_argument, (int *) 0, 'S' },
102   {"fetchdomains",      required_argument, (int *) 0, LA_FETCHDOMAINS },
103   {"smtpaddress", required_argument, (int *) 0, 'D' },
104   {"smtpname",  required_argument, (int *) 0, LA_SMTPNAME },
105   {"antispam",  required_argument, (int *) 0, 'Z' },
106
107   {"batchlimit",required_argument, (int *) 0, 'b' },
108   {"fetchlimit",required_argument, (int *) 0, 'B' },
109   {"fetchsizelimit",required_argument, (int *) 0, LA_FETCHSIZELIMIT },
110   {"fastuidl",  required_argument, (int *) 0, LA_FASTUIDL },
111   {"expunge",   required_argument, (int *) 0, 'e' },
112   {"mda",       required_argument, (int *) 0, 'm' },
113   {"bsmtp",     required_argument, (int *) 0, LA_BSMTP },
114   {"lmtp",      no_argument,       (int *) 0, LA_LMTP },
115
116 #ifdef SSL_ENABLE
117   {"ssl",       no_argument,       (int *) 0, LA_SSL },
118   {"sslkey",    required_argument, (int *) 0, LA_SSLKEY },
119   {"sslcert",   required_argument, (int *) 0, LA_SSLCERT },
120   {"sslproto",   required_argument, (int *) 0, LA_SSLPROTO },
121   {"sslcertck", no_argument,       (int *) 0, LA_SSLCERTCK },
122   {"sslcertpath",   required_argument, (int *) 0, LA_SSLCERTPATH },
123   {"sslfingerprint",   required_argument, (int *) 0, LA_SSLFINGERPRINT },
124 #endif
125
126   {"principal", required_argument, (int *) 0, LA_PRINCIPAL },
127
128 #ifdef CAN_MONITOR
129   {"interface", required_argument, (int *) 0, 'I' },
130   {"monitor",   required_argument, (int *) 0, 'M' },
131 #endif /* CAN_MONITOR */
132   {"plugin",    required_argument, (int *) 0, LA_PLUGIN },
133   {"plugout",   required_argument, (int *) 0, LA_PLUGOUT },
134
135   {"configdump",no_argument,       (int *) 0, LA_CONFIGDUMP },
136
137   {"yydebug",   no_argument,       (int *) 0, 'y' },
138
139   {"tracepolls",no_argument,       (int *) 0, LA_TRACEPOLLS },
140
141   {(char *) 0,  no_argument,       (int *) 0, 0 }
142 };
143
144 static int xatoi(char *s, int *errflagptr)
145 /* do safe conversion from string to number */
146 {
147 #if defined (STDC_HEADERS) && defined (LONG_MAX) && defined (INT_MAX)
148     /* parse and convert numbers, but also check for invalid characters in
149      * numbers
150      */
151
152     char *endptr;
153     long value;
154
155     errno = 0;
156
157     value = strtol(s, &endptr, 0);
158
159     /* any invalid chars in string? */
160     if ( (endptr == s) || (*endptr != '\0') ) {
161         (void) fprintf(stderr, GT_("String '%s' is not a valid number string.\n"), s);
162         (*errflagptr)++;
163         return 0;
164     }
165
166     /* is the range valid? */
167     if ( (((value == LONG_MAX) || (value == LONG_MIN)) && (errno == ERANGE)) ||
168                                 (value > INT_MAX) || (value < INT_MIN)) {
169
170         (void) fprintf(stderr, GT_("Value of string '%s' is %s than %d.\n"), s,
171                                         (value < 0) ? GT_("smaller"): GT_("larger"),
172                                         (value < 0) ? INT_MIN : INT_MAX);
173         (*errflagptr)++;
174         return 0;
175     }
176
177     return (int) value;  /* shut up, I know what I'm doing */
178 #else
179     int i;
180     char *dp;
181 # if defined (STDC_HEADERS)
182     size_t      len;
183 # else
184     int         len;
185 # endif
186
187     /* We do only base 10 conversions here (atoi)! */
188
189     len = strlen(s);
190     /* check for leading white spaces */
191     for (i = 0; (i < len) && isspace((unsigned char)s[i]); i++)
192         ;
193
194     dp = &s[i];
195
196     /* check for +/- */
197     if (i < len && (s[i] == '+' || s[i] == '-'))        i++;
198
199     /* skip over digits */
200     for ( /* no init */ ; (i < len) && isdigit((unsigned char)s[i]); i++)
201         ;
202
203     /* check for trailing garbage */
204     if (i != len) {
205         (void) fprintf(stderr, GT_("String '%s' is not a valid number string.\n"), s);
206         (*errflagptr)++;
207         return 0;
208     }
209
210     /* atoi should be safe by now, except for number range over/underflow */
211     return atoi(dp);
212 #endif
213 }
214
215 int parsecmdline (argc, argv, rctl, ctl)
216 /* parse and validate the command line options */
217 int argc;               /* argument count */
218 char **argv;            /* argument strings */
219 struct runctl *rctl;    /* global run controls to modify */
220 struct query *ctl;      /* option record to be initialized */
221 {
222     /*
223      * return value: if positive, argv index of last parsed option + 1
224      * (presumes one or more server names follows).  if zero, the
225      * command line switches are such that no server names are
226      * required (e.g. --version).  if negative, the command line is
227      * has one or more syntax errors.
228      */
229
230     int c;
231     int ocount = 0;     /* count of destinations specified */
232     int errflag = 0;    /* TRUE when a syntax error is detected */
233     int helpflag = 0;   /* TRUE when option help was explicitly requested */
234     int option_index;
235     char *buf, *cp;
236
237     rctl->poll_interval = -1;
238
239     memset(ctl, '\0', sizeof(struct query));    /* start clean */
240     ctl->smtp_socket = -1;
241
242     while (!errflag && 
243            (c = getopt_long(argc,argv,shortoptions,
244                             longoptions, &option_index)) != -1)
245     {
246         switch (c) {
247         case 'V':
248             versioninfo = TRUE;
249             break;
250         case 'c':
251             check_only = TRUE;
252             break;
253         case 's':
254             outlevel = O_SILENT;
255             break;
256         case 'v':
257             if (outlevel >= O_VERBOSE)
258                 outlevel = O_DEBUG;
259             else
260                 outlevel = O_VERBOSE;
261             break;
262         case 'd':
263             rctl->poll_interval = xatoi(optarg, &errflag);
264             break;
265         case 'N':
266             nodetach = TRUE;
267             break;
268         case 'q':
269             quitmode = TRUE;
270             quitind = optind;
271             break;
272         case 'L':
273             rctl->logfile = prependdir (optarg, currentwd);
274             break;
275         case LA_INVISIBLE:
276             rctl->invisible = TRUE;
277             break;
278         case LA_SHOWDOTS:
279             rctl->showdots = FLAG_TRUE;
280             break;
281         case 'f':
282             xfree(rcfile);
283             rcfile = prependdir (optarg, currentwd);
284             break;
285         case 'i':
286             rctl->idfile = prependdir (optarg, currentwd);
287             break;
288         case LA_POSTMASTER:
289             rctl->postmaster = (char *) xstrdup(optarg);
290             break;
291         case LA_NOBOUNCE:
292             run.bouncemail = FALSE;
293             break;
294         case 'p':
295             /* XXX -- should probably use a table lookup here */
296             if (strcasecmp(optarg,"auto") == 0)
297                 ctl->server.protocol = P_AUTO;
298             else if (strcasecmp(optarg,"pop2") == 0)
299                 ctl->server.protocol = P_POP2;
300 #ifdef SDPS_ENABLE
301             else if (strcasecmp(optarg,"sdps") == 0)
302             {
303                 ctl->server.protocol = P_POP3; 
304                 ctl->server.sdps = TRUE;
305             }
306 #endif /* SDPS_ENABLE */
307             else if (strcasecmp(optarg,"pop3") == 0)
308                 ctl->server.protocol = P_POP3;
309             else if (strcasecmp(optarg,"apop") == 0)
310                 ctl->server.protocol = P_APOP;
311             else if (strcasecmp(optarg,"rpop") == 0)
312                 ctl->server.protocol = P_RPOP;
313             else if (strcasecmp(optarg,"kpop") == 0)
314             {
315                 ctl->server.protocol = P_POP3;
316                 ctl->server.service = KPOP_PORT;
317 #ifdef KERBEROS_V5
318                 ctl->server.authenticate =  A_KERBEROS_V5;
319 #else
320                 ctl->server.authenticate =  A_KERBEROS_V4;
321 #endif /* KERBEROS_V5 */
322             }
323             else if (strcasecmp(optarg,"imap") == 0)
324                 ctl->server.protocol = P_IMAP;
325             else if (strcasecmp(optarg,"etrn") == 0)
326                 ctl->server.protocol = P_ETRN;
327             else if (strcasecmp(optarg,"odmr") == 0)
328                 ctl->server.protocol = P_ODMR;
329             else {
330                 fprintf(stderr,GT_("Invalid protocol `%s' specified.\n"), optarg);
331                 errflag++;
332             }
333             break;
334         case 'U':
335             ctl->server.uidl = FLAG_TRUE;
336             break;
337         case 'P':
338             ctl->server.service = optarg;
339             break;
340         case LA_AUTH:
341             if (strcmp(optarg, "password") == 0)
342                 ctl->server.authenticate = A_PASSWORD;
343             else if (strcmp(optarg, "kerberos") == 0)
344 #ifdef KERBEROS_V5
345                 ctl->server.authenticate = A_KERBEROS_V5;
346 #else
347                 ctl->server.authenticate = A_KERBEROS_V4;
348 #endif /* KERBEROS_V5 */
349             else if (strcmp(optarg, "kerberos_v5") == 0)
350                 ctl->server.authenticate = A_KERBEROS_V5;
351             else if (strcmp(optarg, "kerberos_v4") == 0)
352                 ctl->server.authenticate = A_KERBEROS_V4;
353             else if (strcmp(optarg, "ssh") == 0)
354                 ctl->server.authenticate = A_SSH;
355             else if (strcmp(optarg, "otp") == 0)
356                 ctl->server.authenticate = A_OTP;
357             else if (strcmp(optarg, "opie") == 0)
358                 ctl->server.authenticate = A_OTP;
359             else if (strcmp(optarg, "ntlm") == 0)
360                 ctl->server.authenticate = A_NTLM;
361             else if (strcmp(optarg, "cram") == 0)
362                 ctl->server.authenticate = A_CRAM_MD5;
363             else if (strcmp(optarg, "cram-md5") == 0)
364                 ctl->server.authenticate = A_CRAM_MD5;
365             else if (strcmp(optarg, "gssapi") == 0)
366                 ctl->server.authenticate = A_GSSAPI;
367             else if (strcmp(optarg, "any") == 0)
368                 ctl->server.authenticate = A_ANY;
369             else if (strcmp(optarg, "msn") == 0)
370                 ctl->server.authenticate = A_MSN;
371             else {
372                 fprintf(stderr,GT_("Invalid authentication `%s' specified.\n"), optarg);
373                 errflag++;
374             }
375             break;
376         case 't':
377             ctl->server.timeout = xatoi(optarg, &errflag);
378             if (ctl->server.timeout == 0)
379                 ctl->server.timeout = -1;
380             break;
381         case 'E':
382             ctl->server.envelope = xstrdup(optarg);
383             break;
384         case 'Q':    
385             ctl->server.qvirtual = xstrdup(optarg);
386             break;
387
388         case 'u':
389             ctl->remotename = xstrdup(optarg);
390             break;
391         case 'a':
392             ctl->fetchall = FLAG_TRUE;
393             break;
394         case 'K':
395             ctl->keep = FLAG_FALSE;
396             break;
397         case 'k':
398             ctl->keep = FLAG_TRUE;
399             break;
400         case 'F':
401             ctl->flush = FLAG_TRUE;
402             break;
403         case LA_LIMITFLUSH:
404             ctl->limitflush = FLAG_TRUE;
405             break;
406         case 'n':
407             ctl->rewrite = FLAG_FALSE;
408             break;
409         case 'l':
410             c = xatoi(optarg, &errflag);
411             ctl->limit = NUM_VALUE_IN(c);
412             break;
413         case 'r':
414             buf = xstrdup(optarg);
415             cp = strtok(buf, ",");
416             do {
417                 save_str(&ctl->mailboxes, cp, 0);
418             } while
419                 ((cp = strtok((char *)NULL, ",")));
420             free(buf);
421             break;
422         case 'S':
423             buf = xstrdup(optarg);
424             cp = strtok(buf, ",");
425             do {
426                 save_str(&ctl->smtphunt, cp, TRUE);
427             } while
428                 ((cp = strtok((char *)NULL, ",")));
429             free(buf);
430             ocount++;
431             break;
432         case LA_FETCHDOMAINS:
433             buf = xstrdup(optarg);
434             cp = strtok(buf, ",");
435             do {
436                 save_str(&ctl->domainlist, cp, TRUE);
437             } while
438                 ((cp = strtok((char *)NULL, ",")));
439             free(buf);
440             break;
441         case 'D':
442             ctl->smtpaddress = xstrdup(optarg);
443             break;
444         case LA_SMTPNAME:
445           ctl->smtpname = xstrdup(optarg);
446           break;
447         case 'Z':
448             buf = xstrdup(optarg);
449             cp = strtok(buf, ",");
450             do {
451                 struct idlist   *idp = save_str(&ctl->antispam, NULL, 0);;
452
453                 idp->val.status.num = xatoi(cp, &errflag);
454             } while
455                 ((cp = strtok((char *)NULL, ",")));
456             free(buf);
457             break;
458         case 'b':
459             c = xatoi(optarg, &errflag);
460             ctl->batchlimit = NUM_VALUE_IN(c);
461             break;
462         case 'B':
463             c = xatoi(optarg, &errflag);
464             ctl->fetchlimit = NUM_VALUE_IN(c);
465             break;
466         case LA_FETCHSIZELIMIT:
467             c = xatoi(optarg, &errflag);
468             ctl->fetchsizelimit = NUM_VALUE_IN(c);
469             break;
470         case LA_FASTUIDL:
471             c = xatoi(optarg, &errflag);
472             ctl->fastuidl = NUM_VALUE_IN(c);
473             break;
474         case 'e':
475             c = xatoi(optarg, &errflag);
476             ctl->expunge = NUM_VALUE_IN(c);
477             break;
478         case 'm':
479             ctl->mda = xstrdup(optarg);
480             ocount++;
481             break;
482         case LA_BSMTP:
483             ctl->bsmtp = prependdir (optarg, currentwd);
484             ocount++;
485             break;
486         case LA_LMTP:
487             ctl->listener = LMTP_MODE;
488             break;
489
490 #ifdef CAN_MONITOR
491         case 'I':
492             interface_parse(optarg, &ctl->server);
493             break;
494         case 'M':
495             ctl->server.monitor = xstrdup(optarg);
496             break;
497 #endif /* CAN_MONITOR */
498         case LA_PLUGIN:
499             ctl->server.plugin = xstrdup(optarg);
500             break;
501         case LA_PLUGOUT:
502             ctl->server.plugout = xstrdup(optarg);
503             break;
504
505 #ifdef SSL_ENABLE
506         case LA_SSL:
507             ctl->use_ssl = FLAG_TRUE;
508             break;
509
510         case LA_SSLKEY:
511             ctl->sslkey = prependdir (optarg, currentwd);
512             break;
513
514         case LA_SSLCERT:
515             ctl->sslcert = prependdir (optarg, currentwd);
516             break;
517
518         case LA_SSLPROTO:
519             ctl->sslproto = xstrdup(optarg);
520             break;
521
522         case LA_SSLCERTCK:
523             ctl->sslcertck = FLAG_TRUE;
524             break;
525
526         case LA_SSLCERTPATH:
527             ctl->sslcertpath = prependdir(optarg, currentwd);
528             break;
529
530         case LA_SSLFINGERPRINT:
531             ctl->sslfingerprint = xstrdup(optarg);
532             break;
533 #endif
534
535         case LA_PRINCIPAL:
536             ctl->server.principal = xstrdup(optarg);
537             break;
538
539         case 'y':
540             yydebug = TRUE;
541             break;
542
543         case 'w':
544             c = xatoi(optarg, &errflag);
545             ctl->warnings = NUM_VALUE_IN(c);
546             break;
547
548         case LA_CONFIGDUMP:
549             configdump = TRUE;
550             break;
551
552         case LA_SYSLOG:
553             rctl->use_syslog = FLAG_TRUE;
554             break;
555
556         case LA_NOSYSLOG:
557             rctl->use_syslog = FLAG_FALSE;
558             break;
559
560         case LA_TRACEPOLLS:
561             ctl->server.tracepolls = FLAG_TRUE;
562             break;
563
564         case '?':
565         default:
566             helpflag++;
567         }
568     }
569
570     if (errflag || ocount > 1 || helpflag) {
571         /* squawk if syntax errors were detected */
572 #define P(s)    fputs(s, helpflag ? stdout : stderr)
573         P(GT_("usage:  fetchmail [options] [server ...]\n"));
574         P(GT_("  Options are as follows:\n"));
575         P(GT_("  -?, --help        display this option help\n"));
576         P(GT_("  -V, --version     display version info\n"));
577
578         P(GT_("  -c, --check       check for messages without fetching\n"));
579         P(GT_("  -s, --silent      work silently\n"));
580         P(GT_("  -v, --verbose     work noisily (diagnostic output)\n"));
581         P(GT_("  -d, --daemon      run as a daemon once per n seconds\n"));
582         P(GT_("  -N, --nodetach    don't detach daemon process\n"));
583         P(GT_("  -q, --quit        kill daemon process\n"));
584         P(GT_("  -L, --logfile     specify logfile name\n"));
585         P(GT_("      --syslog      use syslog(3) for most messages when running as a daemon\n"));
586         P(GT_("      --invisible   don't write Received & enable host spoofing\n"));
587         P(GT_("  -f, --fetchmailrc specify alternate run control file\n"));
588         P(GT_("  -i, --idfile      specify alternate UIDs file\n"));
589         P(GT_("      --postmaster  specify recipient of last resort\n"));
590         P(GT_("      --nobounce    redirect bounces from user to postmaster.\n"));
591 #ifdef CAN_MONITOR
592         P(GT_("  -I, --interface   interface required specification\n"));
593         P(GT_("  -M, --monitor     monitor interface for activity\n"));
594 #endif
595 #if defined( SSL_ENABLE )
596         P(GT_("      --ssl         enable ssl encrypted session\n"));
597         P(GT_("      --sslkey      ssl private key file\n"));
598         P(GT_("      --sslcert     ssl client certificate\n"));
599         P(GT_("      --sslcertck   do strict server certificate check (recommended)\n"));
600         P(GT_("      --sslcertpath path to ssl certificates\n"));
601         P(GT_("      --sslfingerprint fingerprint that must match that of the server's cert.\n"));
602         P(GT_("      --sslproto    force ssl protocol (ssl2/ssl3/tls1)\n"));
603 #endif
604         P(GT_("      --plugin      specify external command to open connection\n"));
605         P(GT_("      --plugout     specify external command to open smtp connection\n"));
606
607         P(GT_("  -p, --protocol    specify retrieval protocol (see man page)\n"));
608         P(GT_("  -U, --uidl        force the use of UIDLs (pop3 only)\n"));
609         P(GT_("      --port        TCP port to connect to (obsolete, use --service)\n"));
610         P(GT_("  -P, --service     TCP service to connect to (can be numeric TCP port)\n"));
611         P(GT_("      --auth        authentication type (password/kerberos/ssh/otp)\n"));
612         P(GT_("  -t, --timeout     server nonresponse timeout\n"));
613         P(GT_("  -E, --envelope    envelope address header\n"));
614         P(GT_("  -Q, --qvirtual    prefix to remove from local user id\n"));
615         P(GT_("      --principal   mail service principal\n"));
616         P(GT_("      --tracepolls  add poll-tracing information to Received header\n"));
617
618         P(GT_("  -u, --username    specify users's login on server\n"));
619         P(GT_("  -a, --all         retrieve old and new messages\n"));
620         P(GT_("  -K, --nokeep      delete new messages after retrieval\n"));
621         P(GT_("  -k, --keep        save new messages after retrieval\n"));
622         P(GT_("  -F, --flush       delete old messages from server\n"));
623         P(GT_("      --limitflush  delete oversized messages\n"));
624         P(GT_("  -n, --norewrite   don't rewrite header addresses\n"));
625         P(GT_("  -l, --limit       don't fetch messages over given size\n"));
626         P(GT_("  -w, --warnings    interval between warning mail notification\n"));
627
628         P(GT_("  -S, --smtphost    set SMTP forwarding host\n"));
629         P(GT_("      --fetchdomains fetch mail for specified domains\n"));
630         P(GT_("  -D, --smtpaddress set SMTP delivery domain to use\n"));
631         P(GT_("      --smtpname    set SMTP full name username@domain\n"));
632         P(GT_("  -Z, --antispam,   set antispam response values\n"));
633         P(GT_("  -b, --batchlimit  set batch limit for SMTP connections\n"));
634         P(GT_("  -B, --fetchlimit  set fetch limit for server connections\n"));
635         P(GT_("      --fetchsizelimit set fetch message size limit\n"));
636         P(GT_("      --fastuidl    do a binary search for UIDLs\n"));
637         P(GT_("  -e, --expunge     set max deletions between expunges\n"));
638         P(GT_("  -m, --mda         set MDA to use for forwarding\n"));
639         P(GT_("      --bsmtp       set output BSMTP file\n"));
640         P(GT_("      --lmtp        use LMTP (RFC2033) for delivery\n"));
641         P(GT_("  -r, --folder      specify remote folder name\n"));
642         P(GT_("      --showdots    show progress dots even in logfiles\n"));
643 #undef P
644         /* undocumented:
645          * --configdump (internal use by fetchmailconf, dumps
646          *               configuration as Python source code)
647          * --yydebug    (developer use, enables parser debugging) */
648
649         if (helpflag)
650             exit(PS_SUCCESS);
651         else
652             exit(PS_SYNTAX);
653     }
654
655     return(optind);
656 }
657
658 /* options.c ends here */