export MMHP="$profile"
+
# Group Recipients
cat >"$draft" <<!
-To: Undisclosed recipients: Alice <alice@example.org>, Gill <gill@example.org>;
+To: Undisclosed recipients: Alice <alice@example.org>,
+ Gill <gill@example.org>;
Date: Sun, 25 Oct 2015 18:59:56 +0100
Subject: Group Recipients
----------------
alice@example.org
gill@example.org
!
+
+
+
+cat >"$draft" <<!
+To: charly@example.net
+Cc: friends: alice@example.org, Gill <gill@example.org>;
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group in CC
+----------------
+foo
+!
+
+runandcheck 'spost -debug "$draft"' <<!
+To: charly@example.net
+Cc: friends: ;
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group in CC
+From: Bob <bob@example.org>
+
+foo
+----EOM----
+alice@example.org
+gill@example.org
+charly@example.net
+!
+
+
+
+cat >"$draft" <<!
+To: charly@example.net
+Cc: friends: alice@example.org, Gill <gill@example.org>
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: No semicolon at the end of the group
+----------------
+foo
+!
+
+runandcheck 'spost -debug "$draft"' <<!
+To: charly@example.net
+Cc: friends: ;
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: No semicolon at the end of the group
+From: Bob <bob@example.org>
+
+foo
+----EOM----
+alice@example.org
+gill@example.org
+charly@example.net
+!
+
+
+
+cat >"$draft" <<!
+To: friends: Alice <alice@example.org>, Gill <gill@example.org>;,
+ charly@example.net
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group plus address with comma
+----------------
+foo
+!
+
+runandcheck 'spost -debug "$draft"' <<!
+To: friends: ;, charly@example.net
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group plus address with comma
+From: Bob <bob@example.org>
+
+foo
+----EOM----
+alice@example.org
+gill@example.org
+charly@example.net
+!
+
+
+
+cat >"$draft" <<!
+To: friends: Alice <alice@example.org>, Gill <gill@example.org>;
+ charly@example.net
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group plus address, no comma
+----------------
+foo
+!
+
+runandcheck 'spost -debug "$draft"' <<!
+To: friends: ;, charly@example.net
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group plus address, no comma
+From: Bob <bob@example.org>
+
+foo
+----EOM----
+alice@example.org
+gill@example.org
+charly@example.net
+!
+
+
+
+cat >"$draft" <<!
+To: abc:alice
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: One word with a colon inside
+----------------
+foo
+!
+
+runandcheck 'spost -debug "$draft"' <<!
+To: abc: ;
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: One word with a colon inside
+From: Bob <bob@example.org>
+
+foo
+----EOM----
+alice
+!
+
+
+
+cat >"$draft" <<!
+To: charly
+Dcc: friends: Alice <alice@example.org>, Gill <gill@example.org>;
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group in Dcc
+----------------
+foo
+!
+
+runandcheck 'spost -debug "$draft"' <<!
+To: charly
+Date: Sun, 25 Oct 2015 18:59:56 +0100
+Subject: Group in Dcc
+From: Bob <bob@example.org>
+
+foo
+----EOM----
+alice@example.org
+gill@example.org
+charly
+!
putadr(char *name, struct mailname *nl)
{
struct mailname *mp;
+ char *cp;
int linepos;
int 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);