- 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 ();
-
- /*
- * Check if we've specified an additional profile
- */
- if ((cp = getenv ("MHSTORE"))) {
- if ((fp = fopen (cp, "r"))) {
- readconfig ((struct node **) 0, fp, cp, 0);
- fclose (fp);
+
+ /* null terminate the list of acceptable parts/types */
+ parts[npart] = NULL;
+ types[ntype] = NULL;
+
+ set_endian();
+
+ /*
+ ** Check if we've specified an additional profile
+ */
+ if ((cp = getenv("MHSTORE"))) {
+ if ((fp = fopen(cp, "r"))) {
+ readconfig((struct node **) 0, fp, cp, 0);
+ fclose(fp);
+ } else {
+ admonish("", "unable to read $MHSTORE 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));
+
+ /*
+ ** Cache the current directory before we do any chdirs()'s.
+ */
+ cwd = getcpy(pwd());
+
+ /*
+ ** 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;