+/*
+** Check if the header contains addresses we're interested in.
+** If so, extract the addresses and add them to the global list.
+*/
+static void
+proc_hdr(char *name, char *val)
+{
+ char *cp;
+ int type = 0;
+
+ while (*val==' ' || *val=='\t' || *val=='\n') {
+ val++;
+ }
+ if (strncasecmp(name, "resent-", 7)==0) {
+ resent = HRESENT;
+ }
+ if (mh_strcasecmp(name, "to")==0) {
+ type = HTO;
+ } else if (mh_strcasecmp(name, "cc")==0) {
+ type = HCC;
+ } else if (mh_strcasecmp(name, "bcc")==0) {
+ type = HBCC;
+ } else if (mh_strcasecmp(name, "resent-to")==0) {
+ type = (HRESENT | HTO);
+ } else if (mh_strcasecmp(name, "resent-cc")==0) {
+ type = (HRESENT | HCC);
+ } else if (mh_strcasecmp(name, "resent-bcc")==0) {
+ type = (HRESENT | HBCC);
+ }
+ /* ignore non-recpient headers */
+ if (!type) {
+ return;
+ }
+ /* ignore recipient headers we are not interested in */
+ if ((type&HTO || type&HCC) && !toccsw) {
+ return;
+ }
+ if ((type&HBCC) && !bccsw) {
+ return;
+ }
+
+ while ((cp = getname(val))) {
+ if (!(mp->m_next = getm(cp, NULL, 0, AD_NAME, NULL))) {
+ adios(EX_DATAERR, NULL, "illegal address: %s", cp);
+ }
+ mp = mp->m_next;
+ if (mp->m_type == BADHOST) {
+ admonish(NULL, "bad address `%s'", mp->m_text);
+ continue;
+ }
+ mp->m_type = type;