- 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);
- }
- }