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