X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/f2e833551241a8e085be193e80378004eeee6f51..1316c8d619a6de50544da7c8435d2f6d6045da54:/uip/inc.c diff --git a/uip/inc.c b/uip/inc.c index 8716edd8..2d791f68 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -46,57 +46,39 @@ # 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 NOSASLSW 21 - { "nosasl", SASLminc(-6) }, -#define SASLMECHSW 22 - { "saslmech", SASLminc(-8) }, -#define PROXYSW 23 - { "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 @@ -587,6 +569,7 @@ go_to_it: fflush (stdout); } + /* * Get the mail from a POP server */ @@ -720,7 +703,7 @@ go_to_it: * 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 (;;) { /* @@ -734,19 +717,6 @@ go_to_it: 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)) { @@ -900,6 +870,8 @@ go_to_it: 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 */ @@ -975,39 +947,6 @@ go_to_it: } -#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) {