- char *pp;
- struct mailname *mp;
-#ifndef DUMB
- char *dp;
-#endif /* not DUMB */
-
- if (err && err[0]) {
- if (eresult)
- strcpy (eresult, err);
- else
- if (wanthost == AD_HOST)
- admonish (NULL, "bad address '%s' - %s", str, err);
- return NULL;
- }
- if (pers == NULL
- && mbox == NULL && host == NULL && route == NULL
- && grp == NULL) {
- if (eresult)
- strcpy (eresult, "null address");
- else
- if (wanthost == AD_HOST)
- admonish (NULL, "null address '%s'", str);
- return NULL;
- }
- if (mbox == NULL && grp == NULL) {
- if (eresult)
- strcpy (eresult, "no mailbox in address");
- else
- if (wanthost == AD_HOST)
- admonish (NULL, "no mailbox in address '%s'", str);
- return NULL;
- }
-
- if (dfhost == NULL) {
- dfhost = LocalName ();
- dftype = LOCALHOST;
- }
-
- mp = (struct mailname *) calloc ((size_t) 1, sizeof(*mp));
- if (mp == NULL) {
- if (eresult)
- strcpy (eresult, "insufficient memory to represent address");
- else
- if (wanthost == AD_HOST)
- adios (NULL, "insufficient memory to represent address");
- return NULL;
- }
-
- mp->m_next = NULL;
- mp->m_text = getcpy (str);
- if (pers)
- mp->m_pers = getcpy (pers);
-
- if (mbox == NULL) {
- mp->m_type = BADHOST;
- mp->m_nohost = 1;
- mp->m_ingrp = ingrp;
- mp->m_gname = getcpy (grp);
- if (note)
- mp->m_note = getcpy (note);
- return mp;
- }
-
- if (host) {
- mp->m_mbox = getcpy (mbox);
- mp->m_host = getcpy (host);
- }
- else {
- if ((pp = strchr(mbox, '!'))) {
- *pp++ = '\0';
- mp->m_mbox = getcpy (pp);
- mp->m_host = getcpy (mbox);
- mp->m_type = UUCPHOST;