- if (!msgp)
- msgs[msgp++] = "cur";
- if (!folder)
- folder = getfolder (1);
- maildir = m_maildir (folder);
-
- if (chdir (maildir) == NOTOK)
- adios (maildir, "unable to change directory to");
-
- /* read folder and create message structure */
- if (!(mp = folder_read (folder)))
- adios (NULL, "unable to read folder %s", folder);
-
- /* check for empty folder */
- if (mp->nummsg == 0)
- adios (NULL, "no messages in %s", folder);
-
- /* 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 */
- }
-
- if (filter && access (filter, R_OK) == NOTOK)
- adios (filter, "unable to read");
-
- /*
- * Open form (component) file.
- */
- if (digest) {
- if (issue == 0) {
- snprintf (buf, sizeof(buf), IFORMAT, digest);
- if (volume == 0
- && (cp = context_find (buf))
- && ((issue = atoi (cp)) < 0))
- issue = 0;
- issue++;
- }
- if (volume == 0)
- snprintf (buf, sizeof(buf), VFORMAT, digest);
- if ((cp = context_find (buf)) == NULL || (volume = atoi (cp)) <= 0)
- volume = 1;
- if (!form)
- form = digestcomps;
- in = build_form (form, digest, volume, issue);
- } else {
- if (form) {
- if ((in = open (etcpath (form), O_RDONLY)) == NOTOK)
- adios (form, "unable to open form file");
- } else {
- if ((in = open (etcpath (forwcomps), O_RDONLY)) == NOTOK)
- adios (forwcomps, "unable to open default components file");
- form = forwcomps;
- }
- }
-
- if ((out = creat (drft, m_gmprot ())) == NOTOK)
- adios (drft, "unable to create");
-
- /*
- * copy the components into the draft
- */
- cpydata (in, out, form, drft);
- close (in);
-
- if (file) {
- /* just copy the file into the draft */
- if ((in = open (file, O_RDONLY)) == NOTOK)
- adios (file, "unable to open");
- cpydata (in, out, file, drft);
- close (in);
- close (out);
- } else {
+ if (digest) {
+ if (issue == 0) {
+ snprintf (buf, sizeof(buf), IFORMAT, digest);
+ if (volume == 0
+ && (cp = context_find (buf))
+ && ((issue = atoi (cp)) < 0))
+ issue = 0;
+ issue++;
+ }
+ if (volume == 0)
+ snprintf (buf, sizeof(buf), VFORMAT, digest);
+ if ((cp = context_find (buf)) == NULL || (volume = atoi (cp)) <= 0)
+ volume = 1;
+ if (!form)
+ form = digestcomps;
+ in = build_form (form, digest, volume, issue);
+ } else
+ in = open_form(&form, forwcomps);
+
+ if ((out = creat (drft, m_gmprot ())) == NOTOK)
+ adios (drft, "unable to create");
+