# define SASLminc(a) 0
#endif
-static struct swit switches[] = {
-#define AUDSW 0
- { "audit audit-file", 0 },
-#define NAUDSW 1
- { "noaudit", 0 },
-#define CHGSW 2
- { "changecur", 0 },
-#define NCHGSW 3
- { "nochangecur", 0 },
-#define FILESW 4
- { "file name", 0 },
-#define FORMSW 5
- { "form formatfile", 0 },
-#define FMTSW 6
- { "format string", 5 },
-#define HOSTSW 7
- { "host hostname", 0 },
-#define USERSW 8
- { "user username", 0 },
-#define PACKSW 9
- { "pack file", 0},
-#define NPACKSW 10
- { "nopack", 0 },
-#define PORTSW 11
- { "port name/number", 0 },
-#define SILSW 12
- { "silent", 0 },
-#define NSILSW 13
- { "nosilent", 0 },
-#define TRNCSW 14
- { "truncate", 0 },
-#define NTRNCSW 15
- { "notruncate", 0 },
-#define WIDTHSW 16
- { "width columns", 0 },
-#define VERSIONSW 17
- { "version", 0 },
-#define HELPSW 18
- { "help", 0 },
-#define SNOOPSW 19
- { "snoop", -5 },
-#define SASLSW 20
- { "sasl", SASLminc(-4) },
-#define SASLMECHSW 21
- { "saslmech", SASLminc(-8) },
-#define PROXYSW 22
- { "proxy command", 0 },
- { NULL, 0 }
-};
+#define INC_SWITCHES \
+ X("audit audit-file", 0, AUDSW) \
+ X("noaudit", 0, NAUDSW) \
+ X("changecur", 0, CHGSW) \
+ X("nochangecur", 0, NCHGSW) \
+ X("file name", 0, FILESW) \
+ X("form formatfile", 0, FORMSW) \
+ X("format string", 5, FMTSW) \
+ X("host hostname", 0, HOSTSW) \
+ X("user username", 0, USERSW) \
+ X("pack file", 0, PACKSW) \
+ X("nopack", 0, NPACKSW) \
+ X("port name/number", 0, PORTSW) \
+ X("silent", 0, SILSW) \
+ X("nosilent", 0, NSILSW) \
+ X("truncate", 0, TRNCSW) \
+ X("notruncate", 0, NTRNCSW) \
+ X("width columns", 0, WIDTHSW) \
+ X("version", 0, VERSIONSW) \
+ X("help", 0, HELPSW) \
+ X("snoop", -5, SNOOPSW) \
+ X("sasl", SASLminc(-4), SASLSW) \
+ X("nosasl", SASLminc(-6), NOSASLSW) \
+ X("saslmech", SASLminc(-8), SASLMECHSW) \
+ X("proxy command", 0, PROXYSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(INC);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(INC, switches);
+#undef X
/*
* flags for the mail source
continue;
case PORTSW:
- if (!(host = *argp++) || *port == '-')
+ if (!(port = *argp++) || *port == '-')
adios (NULL, "missing argument to %s", argp[-2]);
continue;
case SASLSW:
sasl++;
continue;
+ case NOSASLSW:
+ sasl = 0;
+ continue;
case SASLMECHSW:
if (!(saslmech = *argp++) || *saslmech == '-')
fflush (stdout);
}
+
/*
* Get the mail from a POP server
*/
* Get the mail from file (usually mail spool)
*/
if (inc_type == INC_FILE && Maildir == NULL) {
- m_unknown (in); /* the MAGIC invocation... */
+ scan_detect_mbox_style (in); /* the MAGIC invocation... */
hghnum = msgnum = mp->hghmsg;
for (;;) {
/*
break;
}
-#if 0
- /* copy file from spool to tmp file */
- tmpfilenam = m_scratch ("", invo_name);
- if ((fd = creat (tmpfilenam, m_gmprot ())) == NOTOK)
- adios (tmpfilenam, "unable to create");
- chmod (tmpfilenam, m_gmprot ());
- if (!(in2 = fdopen (fd, "r+")))
- adios (tmpfilenam, "unable to access");
- cpymsg (in, in2);
-
- /* link message into folder */
- newmsg = folder_addmsg(mp, tmpfilenam);
-#endif
/* create scanline for new message */
switch (incerr = scan (in, msgnum + 1, msgnum + 1, nfs, width,
msgnum == hghnum && chgflag, 1, NULL, 0L, noisy)) {
free (Maildir); /* From now on Maildir is just a flag - don't dref! */
}
+ scan_finished ();
+
if (incerr < 0) { /* error */
if (locked) {
GETGROUPPRIVS(); /* Be sure we can unlock mail file */
}
-#if 0
-
-/*
- * Copy message message from spool into
- * temporary file. Massage the "From " line
- * while copying.
- */
-
-cpymsg (FILE *in, FILE *out)
-{
- int state;
- char *tmpbuf, name[NAMESZ];
-
- for (;;) {
- state = m_getfld (state, name, tmpbuf, rlwidth, in);
- switch (state) {
- case FLD:
- case FLDPLUS:
- break;
- case BODY:
- break;
- case LENERR:
- case FMTERR:
- break;
- case FILEEOF:
- break;
- default:
- }
- }
-}
-#endif /* if 0 */
-
-
static void
inc_done (int status)
{