]> diplodocus.org Git - nmh/blobdiff - sbr/addrsbr.c
Oops, fc31cece had a syntax error that gcc ignored, clang doesn't.
[nmh] / sbr / addrsbr.c
index 23a7cb4cbbd4d27adbfbcda813993cf3a36a126f..70ddb8db0d3e3481f3fbee01fd3457efaadc10d0 100644 (file)
@@ -49,7 +49,7 @@
 
    If an explicit host is not present, then MH checks for a bang to indicate
    an explicit UUCP-style address.  If so, this is noted.  If not, the host is
 
    If an explicit host is not present, then MH checks for a bang to indicate
    an explicit UUCP-style address.  If so, this is noted.  If not, the host is
-   defaulted, typically to the local host.  The lack of an explict host is
+   defaulted, typically to the local host.  The lack of an explicit host is
    also noted.
 
    If an explicit 822-style host is present, then MH checks to see if it
    also noted.
 
    If an explicit 822-style host is present, then MH checks to see if it
@@ -76,18 +76,24 @@ static char *grp = NULL;
 static char *note = NULL;
 static char err[BUFSIZ];
 static char adr[BUFSIZ];
 static char *note = NULL;
 static char err[BUFSIZ];
 static char adr[BUFSIZ];
+static int eai = 0;
+
+void
+enable_eai() {
+    eai = 1;
+}
 
 
 char *
 getname (const char *addrs)
 {
     struct adrx *ap;
 
 
 char *
 getname (const char *addrs)
 {
     struct adrx *ap;
-
     pers = mbox = host = route = grp = note = NULL;
     err[0] = '\0';
 
     pers = mbox = host = route = grp = note = NULL;
     err[0] = '\0';
 
-    if ((ap = getadrx (addrs ? addrs : "")) == NULL)
+    if ((ap = getadrx (addrs ? addrs : "", eai)) == NULL) {
        return NULL;
        return NULL;
+    }
 
     strncpy (adr, ap->text, sizeof(adr));
     pers = ap->pers;
 
     strncpy (adr, ap->text, sizeof(adr));
     pers = ap->pers;
@@ -139,16 +145,7 @@ getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize)
        dftype = LOCALHOST;
     }
 
        dftype = LOCALHOST;
     }
 
-    mp = (struct mailname *) mh_xcalloc ((size_t) 1, sizeof(*mp));
-    if (mp == NULL) {
-       if (eresult) {
-           strncpy (eresult, "insufficient memory to represent address",
-                    eresultsize);
-           eresult[eresultsize - 1] = '\0';
-       }
-       return NULL;
-    }
-
+    NEW0(mp);
     mp->m_next = NULL;
     mp->m_text = getcpy (str);
     if (pers)
     mp->m_next = NULL;
     mp->m_text = getcpy (str);
     if (pers)
@@ -413,7 +410,8 @@ local_test: ;
     for (mp = &mq; mp->m_next;) {
        mp = mp->m_next;
        if (!np->m_mbox)
     for (mp = &mq; mp->m_next;) {
        mp = mp->m_next;
        if (!np->m_mbox)
-           continue; if ((len = strlen (cp = np->m_mbox))
+           continue;
+        if ((len = strlen (cp = np->m_mbox))
                < (i = strlen (pp = mp->m_mbox)))
            continue;
        switch (mp->m_type & W_MBOX) {
                < (i = strlen (pp = mp->m_mbox)))
            continue;
        switch (mp->m_type & W_MBOX) {