]> diplodocus.org Git - nmh/blobdiff - uip/burst.c
Added oauth to mhparam examples.
[nmh] / uip / burst.c
index 34ef10b024d6e883b3fc6473ad27a49e14e85e1f..418fb909b9b8274a90278dd0c317e259e63ea4fd 100644 (file)
@@ -42,7 +42,6 @@ struct smsg {
  */
 
 int debugsw = 0;
-pid_t xpid = 0;
 
 /*
  * static prototypes
@@ -75,13 +74,7 @@ main (int argc, char **argv)
     struct smsg *smsgs;
     struct msgs *mp;
 
-#ifdef LOCALE
-    setlocale(LC_ALL, "");
-#endif
-    invo_name = r1bindex (argv[0], '/');
-
-    /* read user profile/context */
-    context_read();
+    if (nmh_init(argv[0], 1)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -172,7 +165,7 @@ main (int argc, char **argv)
     seq_setprev (mp);  /* set the previous-sequence */
 
     smsgs = (struct smsg *)
-       calloc ((size_t) (MAXFOLDER + 2), sizeof(*smsgs));
+       mh_xcalloc ((size_t) (MAXFOLDER + 2), sizeof(*smsgs));
     if (smsgs == NULL)
        adios (NULL, "unable to allocate burst storage");
 
@@ -294,7 +287,7 @@ find_delim (int msgnum, struct smsg *smsgs, int *mimesw)
        /*
         * Read in lines until we get to a message delimiter.
         *
-        * Previously we checked to make sure the preceeding line and
+        * Previously we checked to make sure the preceding line and
         * next line was a newline.  That actually does not comply with
         * RFC 934, so make sure we break on a message delimiter even
         * if the previous character was NOT a newline.
@@ -464,8 +457,14 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
 
     i = inplace ? msgnum + numburst : mp->hghmsg;
     for (j = numburst; j >= (inplace ? 0 : 1); i--, j--) {
+        char *tempfile;
+
+       if ((tempfile = m_mktemp2(NULL, invo_name, NULL, &out)) == NULL) {
+           adios(NULL, "unable to create temporary file in %s",
+                 get_temp_dir());
+       }
+       strncpy (f2, tempfile, sizeof(f2));
        strncpy (f1, m_name (i), sizeof(f1));
-       strncpy (f2, m_mktemp(invo_name, NULL, &out), sizeof(f2));
 
        if (verbosw && i != msgnum)
            printf ("message %d of digest %d becomes message %d\n", j, msgnum, i);
@@ -504,7 +503,7 @@ burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
 #define S4  3
 
 /*
- * Copy a mesage which is being burst out of a digest.
+ * Copy a message which is being burst out of a digest.
  * It will remove any "dashstuffing" in the message.
  */