refile: Never change the current folder
[mmh] / uip / spost.c
index 4a24fc4..ce3e684 100644 (file)
@@ -211,7 +211,7 @@ main(int argc, char **argv)
                verbose++;
                out = stdout;
        } else {
-               tmpfil = getcpy(m_mktemp2("/tmp/", invo_name, NULL, &out));
+               tmpfil = mh_xstrdup(m_mktemp2("/tmp/", invo_name, NULL, &out));
        }
 
        /* check for "Aliasfile:" profile entry */
@@ -219,7 +219,7 @@ main(int argc, char **argv)
                char *dp, **ap; 
 
                aliasflg = 1;
-               for (ap=brkstring(dp=getcpy(cp), " ", "\n"); ap && *ap;
+               for (ap=brkstring(dp=mh_xstrdup(cp), " ", "\n"); ap && *ap;
                                ap++) {
                        if ((state = alias(etcpath(*ap))) != AK_OK) {
                                adios(EX_IOERR, NULL, "aliasing error in file %s: %s",
@@ -236,14 +236,14 @@ main(int argc, char **argv)
                case FLD:
                case FLDPLUS:
                        compnum++;
-                       cp = getcpy(buf);
+                       cp = mh_xstrdup(buf);
                        while (state == FLDPLUS) {
                                state = m_getfld(state, name, buf,
                                                sizeof(buf), in);
                                cp = add(buf, cp);
                        }
                        putfmt(name, cp, out);
-                       free(cp);
+                       mh_free0(&cp);
                        continue;
 
                case BODY:
@@ -319,7 +319,7 @@ main(int argc, char **argv)
                adios(EX_DATAERR, NULL, "message has no recipients");
        }
 
-       sargv = mh_xmalloc(sizeof(char **) * (recipientsc + 4));
+       sargv = mh_xcalloc(recipientsc + 4, sizeof(char **));
 
        argp = sargv;
        *argp++ = "send-mail";
@@ -329,7 +329,7 @@ main(int argc, char **argv)
        }
 
        while (recipients != NULL) {
-               cp = getcpy(recipients->m_mbox);
+               cp = mh_xstrdup(recipients->m_mbox);
                if (recipients->m_host) {
                        cp = add("@", cp);
                        cp = add(recipients->m_host, cp);
@@ -405,7 +405,7 @@ putfmt(char *name, char *str, FILE *out)
        }
 
        if (hdr->flags & HSUB) {
-               subject = getcpy(str);
+               subject = mh_xstrdup(str);
        }
 
        if (!(hdr->flags & HADR)) {
@@ -551,10 +551,10 @@ putadr(char *name, struct mailname *nl)
                }
                if (mp->m_ingrp) {
                        if (mp->m_gname != NULL) {
-                               cp = getcpy(mp->m_gname);
+                               cp = mh_xstrdup(mp->m_gname);
                                cp = add(";", cp);
                                linepos = putone(cp, linepos, namelen);
-                               free(cp);
+                               mh_free0(&cp);
                                cp = NULL;
                        }
                } else {
@@ -650,7 +650,7 @@ fcc(char *file, char *folders)
                fprintf(stderr, "Skipped %sFcc %s: unable to system().\n",
                                msgstate == resent ? "Resent-" : "", folders);
        } else if (status != 0) {
-               fprintf(stderr, "%sFcc %s: Problems occured.\n",
+               fprintf(stderr, "%sFcc %s: Problems occurred.\n",
                                msgstate == resent ? "Resent-" : "", folders);
        }
 }
@@ -666,7 +666,7 @@ process_bccs(char *origmsg)
        FILE *out = NULL;
 
        for (mp=bccs; mp; mp=mp->m_next) {
-               bccdraft = getcpy(m_mktemp2("/tmp/", invo_name, NULL, &out));
+               bccdraft = mh_xstrdup(m_mktemp2("/tmp/", invo_name, NULL, &out));
                fprintf(out, "To: %s\n", mp->m_text);
                if (from) {
                        fprintf(out, "From: %s\n", from->m_text);