X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/3c9700d8d045f3ff26ce5dd2a174454dafc14822..afee8ed17a56617618fb7f963b111d7cf0fb56e7:/uip/whom.c?ds=sidebyside diff --git a/uip/whom.c b/uip/whom.c index 5a825344..3830e5eb 100644 --- a/uip/whom.c +++ b/uip/whom.c @@ -2,40 +2,55 @@ /* * whom.c -- report to whom a message would be sent * - * $Id$ + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include #include #include -static struct swit switches[] = { -#define ALIASW 0 - { "alias aliasfile", 0 }, -#define CHKSW 1 - { "check", 0 }, -#define NOCHKSW 2 - { "nocheck", 0 }, -#define DRAFTSW 3 - { "draft", 0 }, -#define DFOLDSW 4 - { "draftfolder +folder", 6 }, -#define DMSGSW 5 - { "draftmessage msg", 6 }, -#define NDFLDSW 6 - { "nodraftfolder", 0 }, -#define VERSIONSW 7 - { "version", 0 }, -#define HELPSW 8 - { "help", 4 }, -#define CLIESW 9 - { "client host", -6 }, -#define SERVSW 10 - { "server host", -6 }, -#define SNOOPSW 11 - { "snoop", -5 }, - { NULL, 0 } -}; +#ifndef CYRUS_SASL +# define SASLminc(a) (a) +#else /* CYRUS_SASL */ +# define SASLminc(a) 0 +#endif /* CYRUS_SASL */ + +#ifndef TLS_SUPPORT +# define TLSminc(a) (a) +#else /* TLS_SUPPORT */ +# define TLSminc(a) 0 +#endif /* TLS_SUPPORT */ + +#define WHOM_SWITCHES \ + X("alias aliasfile", 0, ALIASW) \ + X("check", 0, CHKSW) \ + X("nocheck", 0, NOCHKSW) \ + X("draft", 0, DRAFTSW) \ + X("draftfolder +folder", 6, DFOLDSW) \ + X("draftmessage msg", 6, DMSGSW) \ + X("nodraftfolder", 0, NDFLDSW) \ + X("version", 0, VERSIONSW) \ + X("help", 0, HELPSW) \ + X("client host", -6, CLIESW) \ + X("server host", -6, SERVSW) \ + X("snoop", -5, SNOOPSW) \ + X("sasl", SASLminc(4), SASLSW) \ + X("saslmech mechanism", SASLminc(-5), SASLMECHSW) \ + X("user username", SASLminc(-4), USERSW) \ + X("port server port name/number", 4, PORTSW) \ + X("tls", TLSminc(-3), TLSSW) \ + X("notls", TLSminc(-5), NTLSSW) \ + X("mts smtp|sendmail/smtp|sendmail/pipe", 0, MTSSW) \ + +#define X(sw, minchars, id) id, +DEFINE_SWITCH_ENUM(WHOM); +#undef X + +#define X(sw, minchars, id) { sw, minchars, id }, +DEFINE_SWITCH_ARRAY(WHOM, switches); +#undef X int @@ -64,6 +79,9 @@ main (int argc, char **argv) vec[vecp++] = "-library"; vec[vecp++] = getcpy (m_maildir ("")); + /* Don't need to feed fileproc or mhlproc to post because + it doesn't use them when used for whom. */ + while ((cp = *argp++)) { if (*cp == '-') { switch (smatch (++cp, switches)) { @@ -76,14 +94,17 @@ main (int argc, char **argv) case HELPSW: snprintf (buf, sizeof(buf), "%s [switches] [file]", invo_name); print_help (buf, switches, 1); - done (1); + done (0); case VERSIONSW: print_version(invo_name); - done (1); + done (0); case CHKSW: case NOCHKSW: case SNOOPSW: + case SASLSW: + case TLSSW: + case NTLSSW: vec[vecp++] = --cp; continue; @@ -113,6 +134,10 @@ main (int argc, char **argv) case ALIASW: case CLIESW: case SERVSW: + case USERSW: + case PORTSW: + case SASLMECHSW: + case MTSSW: vec[vecp++] = --cp; if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]);