X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fspost.c;h=53ae86a72538b71b30764bdec435315988c0e6f8;hp=04479a1f6247e2ebcd3afbd1c2bc721ea254b3d6;hb=04a3dfc70394a517a79340a7d3ecd9c6a23d0bee;hpb=4cc601f996579386ce4f4937b9b72b7b3d891107 diff --git a/uip/spost.c b/uip/spost.c index 04479a1..53ae86a 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -117,6 +117,7 @@ static enum { static char *tmpfil; static char *subject = NULL; /* the subject field for BCC'ing */ +static struct mailname *from = NULL; /* the from field for BCC'ing */ static char fccs[BUFSIZ] = ""; struct mailname *bccs = NULL; /* list of the bcc recipients */ struct mailname *recipients = NULL; /* list of the recipients */ @@ -212,7 +213,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 */ @@ -220,7 +221,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", @@ -311,7 +312,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"; @@ -321,7 +322,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); @@ -397,7 +398,7 @@ putfmt(char *name, char *str, FILE *out) } if (hdr->flags & HSUB) { - subject = getcpy(str); + subject = mh_xstrdup(str); } if (!(hdr->flags & HADR)) { @@ -428,11 +429,11 @@ putfmt(char *name, char *str, FILE *out) /* needed because the address parser holds global state */ ismymbox(NULL); - for ( mp = addr_start.m_next; mp; mp = mp->m_next) { + for (mp = addr_start.m_next; mp; mp = mp->m_next) { if (ismymbox(mp)) { msgflags |= MFMM; if (my == NULL) { - my = mp; + from = my = mp; } } } @@ -543,10 +544,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 { @@ -642,7 +643,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); } } @@ -658,8 +659,11 @@ 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); + } fprintf(out, "Subject: [BCC] %s", subject ? subject : ""); fprintf(out, "%s: %s\n", attach_hdr, origmsg); fprintf(out, "------------\n");