- if (*cp == '+' || *cp == '@') {
- if (folder)
- adios (NULL, "only one folder at a time!");
- else
- folder = pluspath (cp);
- } else
- app_msgarg(&msgs, cp);
- }
-
- /* null terminate the list of acceptable parts/types */
- parts[npart] = NULL;
- types[ntype] = NULL;
-
- set_endian ();
-
- if ((cp = getenv ("MM_NOASK")) && !strcmp (cp, "1")) {
- nolist = 1;
- pausesw = 0;
- }
-
- /*
- * Check if we've specified an additional profile
- */
- if ((cp = getenv ("MHSHOW"))) {
- if ((fp = fopen (cp, "r"))) {
- readconfig ((struct node **) 0, fp, cp, 0);
- fclose (fp);
- } else {
- admonish ("", "unable to read $MHSHOW profile (%s)", cp);
- }
- }
-
- /*
- * Read the standard profile setup
- */
- if ((fp = fopen (cp = etcpath ("mhn.defaults"), "r"))) {
- readconfig ((struct node **) 0, fp, cp, 0);
- fclose (fp);
- }
-
- /* Check for public cache location */
- if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
- cache_public = NULL;
-
- /* Check for private cache location */
- if (!(cache_private = context_find (nmhprivcache)))
- cache_private = ".cache";
- cache_private = getcpy (m_maildir (cache_private));
-
- /*
- * Check for storage directory. If specified,
- * then store temporary files there. Else we
- * store them in standard nmh directory.
- */
- if ((cp = context_find (nmhstorage)) && *cp)
- tmp = concat (cp, "/", invo_name, NULL);
- else
- tmp = add (m_maildir (invo_name), NULL);
-
- if (!context_find ("path"))
- free (path ("./", TFOLDER));
-
- if (file && msgs.size)
- adios (NULL, "cannot specify msg and file at same time!");
-
- /*
- * check if message is coming from file
- */
- if (file) {
- if (!(cts = (CT *) calloc ((size_t) 2, sizeof(*cts))))
- adios (NULL, "out of memory");
- ctp = cts;
-
- if ((ct = parse_mime (file)));
- *ctp++ = ct;
- } else {
- /*
- * message(s) are coming from a folder
- */
- if (!msgs.size)
- app_msgarg(&msgs, "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 < msgs.size; msgnum++)
- if (!m_convert (mp, msgs.msgs[msgnum]))
- done (1);