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