X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=uip%2Fsend.c;h=45b5e2611aa0b290a46fdfa008a66bf06bc5d593;hb=337338b404931f06f0db2119c9e145e8ca5a9860;hp=d1a183e5a3c3cc9e39e9bedc609c86495cb8af0f;hpb=dc6c45394a06750eab463a2523406eed6c77e2e1;p=mmh diff --git a/uip/send.c b/uip/send.c index d1a183e..45b5e26 100644 --- a/uip/send.c +++ b/uip/send.c @@ -17,93 +17,75 @@ static struct swit switches[] = { { "alias aliasfile", 0 }, #define DEBUGSW 1 { "debug", -5 }, -#define DRAFTSW 2 - { "draft", 0 }, -#define DFOLDSW 3 - { "draftfolder +folder", 6 }, -#define DMSGSW 4 - { "draftmessage msg", 6 }, -#define NDFLDSW 5 - { "nodraftfolder", 0 }, -#define FILTSW 6 +#define FILTSW 2 { "filter filterfile", 0 }, -#define NFILTSW 7 +#define NFILTSW 3 { "nofilter", 0 }, -#define FRMTSW 8 +#define FRMTSW 4 { "format", 0 }, -#define NFRMTSW 9 +#define NFRMTSW 5 { "noformat", 0 }, -#define FORWSW 10 +#define FORWSW 6 { "forward", 0 }, -#define NFORWSW 11 +#define NFORWSW 7 { "noforward", 0 }, -#define MIMESW 12 +#define MIMESW 8 { "mime", 0 }, -#define NMIMESW 13 +#define NMIMESW 9 { "nomime", 0 }, -#define MSGDSW 14 +#define MSGDSW 10 { "msgid", 0 }, -#define NMSGDSW 15 +#define NMSGDSW 11 { "nomsgid", 0 }, -#define PUSHSW 16 +#define PUSHSW 12 { "push", 0 }, -#define NPUSHSW 17 +#define NPUSHSW 13 { "nopush", 0 }, -#define UNIQSW 19 +#define UNIQSW 14 { "unique", -6 }, -#define NUNIQSW 20 +#define NUNIQSW 15 { "nounique", -8 }, -#define VERBSW 21 +#define VERBSW 16 { "verbose", 0 }, -#define NVERBSW 22 +#define NVERBSW 17 { "noverbose", 0 }, -#define WATCSW 23 +#define WATCSW 18 { "watch", 0 }, -#define NWATCSW 24 +#define NWATCSW 19 { "nowatch", 0 }, -#define WIDTHSW 25 +#define WIDTHSW 20 { "width columns", 0 }, -#define VERSIONSW 26 +#define VERSIONSW 21 { "version", 0 }, -#define HELPSW 27 +#define HELPSW 22 { "help", 0 }, -#define BITSTUFFSW 28 +#define BITSTUFFSW 23 { "dashstuffing", -12 }, -#define NBITSTUFFSW 29 +#define NBITSTUFFSW 24 { "nodashstuffing", -14 }, -#define MAILSW 30 +#define MAILSW 25 { "mail", -4 }, -#define SAMLSW 31 +#define SAMLSW 26 { "saml", -4 }, -#define SENDSW 32 +#define SENDSW 27 { "send", -4 }, -#define SOMLSW 33 +#define SOMLSW 28 { "soml", -4 }, -#define CLIESW 34 +#define CLIESW 29 { "client host", -6 }, -#define SERVSW 35 +#define SERVSW 30 { "server host", 6 }, -#define SNOOPSW 36 +#define SNOOPSW 31 { "snoop", 5 }, -#define ATTACHSW 40 +#define ATTACHSW 32 { "attach", 6 }, -#define ATTACHFORMATSW 41 +#define ATTACHFORMATSW 33 { "attachformat", 7 }, -#define PORTSW 42 +#define PORTSW 34 { "port server-port-name/number" , 4 }, { NULL, 0 } }; -static struct swit anyl[] = { -#define NOSW 0 - { "no", 0 }, -#define YESW 1 - { "yes", 0 }, -#define LISTDSW 2 - { "list", 0 }, - { NULL, 0 } -}; - extern int debugsw; /* from sendsbr.c */ extern int forwsw; extern int inplace; @@ -120,9 +102,9 @@ int main (int argc, char **argv) { int msgp = 0, distsw = 0, vecp = 1; - int isdf = 0, mime = 0; + int mime = 0; int msgnum, status; - char *cp, *dfolder = NULL, *maildir = NULL; + char *cp, *maildir = NULL; char buf[BUFSIZ], **ap, **argp, **arguments; char *msgs[MAXARGS], *vec[MAXARGS]; struct msgs *mp; @@ -164,28 +146,6 @@ main (int argc, char **argv) print_version(invo_name); done (1); - case DRAFTSW: - msgs[msgp++] = draft; - continue; - - case DFOLDSW: - if (dfolder) - adios (NULL, "only one draft folder at a time!"); - if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); - dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp, - *cp != '@' ? TFOLDER : TSUBCWF); - continue; - case DMSGSW: - if (!(cp = *argp++) || *cp == '-') - adios (NULL, "missing argument to %s", argp[-2]); - msgs[msgp++] = cp; - continue; - case NDFLDSW: - dfolder = NULL; - isdf = NOTOK; - continue; - case PUSHSW: pushsw++; continue; @@ -293,77 +253,39 @@ main (int argc, char **argv) } } - if (dfolder == NULL) { - if (msgp == 0) { -#ifdef WHATNOW - if ((cp = getenv ("mhdraft")) && *cp) { - msgs[msgp++] = cp; - goto go_to_it; - } -#endif /* WHATNOW */ - msgs[msgp++] = getcpy (m_draft (NULL, NULL, 1, &isdf)); - if (stat (msgs[0], &st) == NOTOK) - adios (msgs[0], "unable to stat draft file"); - cp = concat ("Use \"", msgs[0], "\"? ", NULL); - for (status = LISTDSW; status != YESW;) { - if (!(argp = getans (cp, anyl))) - done (1); - switch (status = smatch (*argp, anyl)) { - case NOSW: - done (0); - case YESW: - break; - case LISTDSW: - showfile (++argp, msgs[0]); - break; - default: - advise (NULL, "say what?"); - break; - } - } - } else { - for (msgnum = 0; msgnum < msgp; msgnum++) - msgs[msgnum] = getcpy (m_maildir (msgs[msgnum])); - } - } else { - if (!context_find ("path")) - free (path ("./", TFOLDER)); - - if (!msgp) - msgs[msgp++] = "cur"; - maildir = m_maildir (dfolder); - - if (chdir (maildir) == NOTOK) - adios (maildir, "unable to change directory to"); - - /* read folder and create message structure */ - if (!(mp = folder_read (dfolder))) - adios (NULL, "unable to read folder %s", dfolder); - - /* check for empty folder */ - if (mp->nummsg == 0) - adios (NULL, "no messages in %s", dfolder); - - /* parse all the message ranges/sequences and set SELECTED */ - for (msgnum = 0; msgnum < msgp; msgnum++) - if (!m_convert (mp, msgs[msgnum])) - done (1); - seq_setprev (mp); /* set the previous-sequence */ - - for (msgp = 0, msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { - if (is_selected (mp, msgnum)) { - msgs[msgp++] = getcpy (m_name (msgnum)); - unset_exists (mp, msgnum); - } - } + if (!context_find ("path")) + free (path ("./", TFOLDER)); - mp->msgflags |= SEQMOD; - seq_save (mp); + if (!msgp) + msgs[msgp++] = "cur"; + maildir = m_maildir (draftfolder); + + if (chdir (maildir) == NOTOK) + adios (maildir, "unable to change directory to"); + + /* read folder and create message structure */ + if (!(mp = folder_read (draftfolder))) + adios (NULL, "unable to read draft folder %s", draftfolder); + + /* check for empty folder */ + if (mp->nummsg == 0) + adios (NULL, "no messages in draft folder %s", draftfolder); + + /* parse all the message ranges/sequences and set SELECTED */ + for (msgnum = 0; msgnum < msgp; msgnum++) + if (!m_convert (mp, msgs[msgnum])) + done (1); + seq_setprev (mp); /* set the previous-sequence */ + + for (msgp = 0, msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { + if (is_selected (mp, msgnum)) { + msgs[msgp++] = getcpy (m_name (msgnum)); + unset_exists (mp, msgnum); + } } -#ifdef WHATNOW -go_to_it: -#endif /* WHATNOW */ + mp->msgflags |= SEQMOD; + seq_save (mp); if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0) if ((cp = context_find ("signature")) && *cp)