projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace mh_xmalloc() with mh_xcalloc()
[mmh]
/
uip
/
spost.c
diff --git
a/uip/spost.c
b/uip/spost.c
index
780b5f4
..
a4c170b
100644
(file)
--- 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 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 */
static char fccs[BUFSIZ] = "";
struct mailname *bccs = NULL; /* list of the bcc recipients */
struct mailname *recipients = NULL; /* list of the recipients */
@@
-318,7
+319,7
@@
main(int argc, char **argv)
adios(EX_DATAERR, NULL, "message has no recipients");
}
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";
argp = sargv;
*argp++ = "send-mail";
@@
-435,11
+436,11
@@
putfmt(char *name, char *str, FILE *out)
/* needed because the address parser holds global state */
ismymbox(NULL);
/* 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) {
if (ismymbox(mp)) {
msgflags |= MFMM;
if (my == NULL) {
- my = mp;
+ from = my = mp;
}
}
}
}
}
}
@@
-535,6
+536,7
@@
static void
putadr(char *name, struct mailname *nl)
{
struct mailname *mp;
putadr(char *name, struct mailname *nl)
{
struct mailname *mp;
+ char *cp;
int linepos;
int namelen;
int linepos;
int namelen;
@@
-547,7
+549,17
@@
putadr(char *name, struct mailname *nl)
fprintf(out, "\n%s: ", name);
linepos = namelen;
}
fprintf(out, "\n%s: ", name);
linepos = namelen;
}
- linepos = putone(mp->m_text, linepos, namelen);
+ if (mp->m_ingrp) {
+ if (mp->m_gname != NULL) {
+ cp = getcpy(mp->m_gname);
+ cp = add(";", cp);
+ linepos = putone(cp, linepos, namelen);
+ free(cp);
+ cp = NULL;
+ }
+ } else {
+ linepos = putone(mp->m_text, linepos, namelen);
+ }
mp = mp->m_next;
}
putc('\n', out);
mp = mp->m_next;
}
putc('\n', out);
@@
-656,6
+668,9
@@
process_bccs(char *origmsg)
for (mp=bccs; mp; mp=mp->m_next) {
bccdraft = getcpy(m_mktemp2("/tmp/", invo_name, NULL, &out));
fprintf(out, "To: %s\n", mp->m_text);
for (mp=bccs; mp; mp=mp->m_next) {
bccdraft = getcpy(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");
fprintf(out, "Subject: [BCC] %s", subject ? subject : "");
fprintf(out, "%s: %s\n", attach_hdr, origmsg);
fprintf(out, "------------\n");