]> diplodocus.org Git - nmh/commitdiff
Garbage collect "normalize".
authorKen Hornstein <kenh@pobox.com>
Thu, 5 Dec 2013 02:56:50 +0000 (21:56 -0500)
committerKen Hornstein <kenh@pobox.com>
Thu, 5 Dec 2013 03:00:12 +0000 (22:00 -0500)
The code to normalize addresses (look up the hostnames in DNS for the
"official" hostnames) was disabled when we made DUMB the default configuration
in 1.5.  Since them, the -normalize switch was still around in various
utilities, but it didn't do anything.  Remove all of those switches and
garbage collect various other bits of the "normalize" functionality.

At the same time, improve getm() a bit; it now takes an argument specifying
the length of the error buffer.

19 files changed:
Makefile.am
h/addrsbr.h
h/fmt_scan.h
man/ali.man
man/ap.man
man/fmttest.man
sbr/addrsbr.c
sbr/encode_rfc2047.c
sbr/fmt_addr.c
sbr/fmt_def.c [deleted file]
sbr/fmt_scan.c
test/ali/test-ali
uip/ali.c
uip/aliasbr.c
uip/ap.c
uip/fmttest.c
uip/mhlsbr.c
uip/post.c
uip/replsbr.c

index a056b24bfd75425dbcd184517b5fec59f917f71b..13b6d448aea69f60fd997fbeffd05ff3a93dfd75 100644 (file)
@@ -551,7 +551,7 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/arglist.c \
                      sbr/snprintb.c sbr/ssequal.c \
                      sbr/strindex.c sbr/trimcpy.c sbr/unquote.c \
                      sbr/uprf.c sbr/vfgets.c \
                      sbr/snprintb.c sbr/ssequal.c \
                      sbr/strindex.c sbr/trimcpy.c sbr/unquote.c \
                      sbr/uprf.c sbr/vfgets.c \
-                     sbr/fmt_def.c sbr/mf.c sbr/utils.c sbr/ctype-checked.c \
+                     sbr/mf.c sbr/utils.c sbr/ctype-checked.c \
                      sbr/m_mktemp.c sbr/getansreadline.c sbr/vector.c \
                      config/config.c config/version.c
 
                      sbr/m_mktemp.c sbr/getansreadline.c sbr/vector.c \
                      config/config.c config/version.c
 
index fbb4cd055872ed380c435c5bf44b1f803756816e..de5dc3b43aff42ade899521187caa87f8d1545e8 100644 (file)
@@ -3,10 +3,6 @@
  * addrsbr.h -- definitions for the address parsing system
  */
 
  * addrsbr.h -- definitions for the address parsing system
  */
 
-#define        AD_HOST 1               /* getm(): lookup official hostname    */
-#define        AD_NHST 0               /* getm(): do not lookup official name */
-#define        AD_NAME AD_NHST         /* AD_HOST is TOO slow                 */
-
 #define        UUCPHOST        (-1)
 #define        LOCALHOST       0
 #define        NETHOST         1
 #define        UUCPHOST        (-1)
 #define        LOCALHOST       0
 #define        NETHOST         1
@@ -93,21 +89,17 @@ char *auxformat(struct mailname *mp, int extras);
  *               localhost().
  * dftype      - If dfhost is given, use dftype as the email address type
  *               if no host is in the email address.
  *               localhost().
  * dftype      - If dfhost is given, use dftype as the email address type
  *               if no host is in the email address.
- * wanthost    - One of AD_HOST or AD_NHST.  If AD_HOST, look up the
- *               "official name" of the host.  Well, that's what the
- *               documentation says, at least ... support for that
- *               functionality was removed when hostable support was
- *               removed and the address parser was converted by default
- *               to always being in DUMB mode.  So nowadays this only
- *               affects where error messages are put if there is no
- *               host part (set it to AD_HOST if you want error messages
- *               to appear on standard error).
- * eresult     - Any error string returned by the address parser.  String
- *               must contain sufficient room for the error message.
- *               (BUFSIZ is used in general by the code).  Can be NULL.
+ * eresult     - A buffer containing an error message returned by the
+ *               address parser.  May be NULL.
+ * eresultsize - The size of the buffer passed in eresult.
  *
  * A pointer to an allocated struct mailname corresponding to the email
  * address is returned.
  *
  * A pointer to an allocated struct mailname corresponding to the email
  * address is returned.
+ *
+ * This function used to have an argument called 'wanthost' which would
+ * control whether or not it would canonicalize hostnames in email
+ * addresses.  This functionalit was removed for nmh 1.5, and eventually
+ * all of the code that used this argument was garbage collected.
  */
  */
-struct mailname *getm(char *str, char *dfhost, int dftype,
-                     int wanthost, char *eresult);
+struct mailname *getm(char *str, char *dfhost, int dftype, char *eresult,
+                     size_t eresultsize);
index 771d9fbaea4928087546927004a0c7fb35cbd5c1..4d768b7bbe0e69ea3a233610b8a9ed35b19d86c6 100644 (file)
@@ -49,8 +49,6 @@ struct comp {
 
 #define CF_BITS       "\020\01TRUE\02PARSED\03CF_DATEFAB\04TRIMMED"
 
 
 #define CF_BITS       "\020\01TRUE\02PARSED\03CF_DATEFAB\04TRIMMED"
 
-extern int fmt_norm;
-
 /*
  * This structure defines one formatting instruction.
  */
 /*
  * This structure defines one formatting instruction.
  */
index 4ef473e7b595a4cbda3d6f20ba1181eee47c894a..3e43bad129b1005d4c52ea6c6ab2aaa6f62e6944 100644 (file)
@@ -11,7 +11,6 @@ ali \- list mail aliases
 .RB [ \-alias
 .IR aliasfile ]
 .RB [ \-list " | " \-nolist ]
 .RB [ \-alias
 .IR aliasfile ]
 .RB [ \-list " | " \-nolist ]
-.RB [ \-normalize " | " \-nonormalize ]
 .RB [ \-user " | " \-nouser ]
 .RB [ \-version ]
 .RB [ \-help ] 
 .RB [ \-user " | " \-nouser ]
 .RB [ \-version ]
 .RB [ \-help ] 
@@ -42,12 +41,7 @@ an inverted fashion: instead of listing the addresses that each given
 alias expands to,
 .B ali
 will list the aliases that expand to each
 alias expands to,
 .B ali
 will list the aliases that expand to each
-given address.  If the
-.B \-normalize
-switch is given,
-.B ali
-will
-try to track down the official hostname of the address.
+given address.
 .PP
 The files specified by the profile entry
 .RI \*(lq Aliasfile \*(rq
 .PP
 The files specified by the profile entry
 .RI \*(lq Aliasfile \*(rq
@@ -94,8 +88,6 @@ aliasfile
 .TP
 \-nolist
 .TP
 .TP
 \-nolist
 .TP
-\-nonormalize
-.TP
 \-nouser
 .PD
 .SH CONTEXT
 \-nouser
 .PD
 .SH CONTEXT
index cc5575c815db452c1f7cfdabd330fd56907f1409..5c5fa402cb4b365910a2fc9b2417503c118aba55 100644 (file)
@@ -12,7 +12,6 @@ ap \- parse addresses RFC 822-style
 .IR formatfile ]
 .RB [ \-format
 .IR string ]
 .IR formatfile ]
 .RB [ \-format
 .IR string ]
-.RB [ \-normalize " | " \-nonormalize ]
 .RB [ \-width
 .IR columns ]
 .RB [ \-version ]
 .RB [ \-width
 .IR columns ]
 .RB [ \-version ]
@@ -60,13 +59,6 @@ error        string  A diagnostic if the parse failed
 .RE
 .fi
 .PP
 .RE
 .fi
 .PP
-If the
-.B \-normalize
-switch is given,
-.B ap
-will try to track down
-the official hostname of the address.
-.PP
 Here is the default format string used by
 .BR ap :
 .PP
 Here is the default format string used by
 .BR ap :
 .PP
@@ -100,8 +92,6 @@ Standard for the Format of ARPA Internet Text Messages
 -format
 As described above.
 .TP
 -format
 As described above.
 .TP
-\-normalize
-.TP
 \-width
 The width of the terminal.
 .PD
 \-width
 The width of the terminal.
 .PD
index 09254421e55c55a2ee58d23a324fb9baa6ab2b09..b34d2e9faff86692f0036e4fa0afc190601cd97a 100644 (file)
@@ -20,7 +20,6 @@ language
 .IR component-text ]
 .RB [ \-dupaddrs " | " \-nodupaddrs ]
 .RB [ \-ccme " | " \-noccme ]
 .IR component-text ]
 .RB [ \-dupaddrs " | " \-nodupaddrs ]
 .RB [ \-ccme " | " \-noccme ]
-.RB [ \-normalize " | " \-nonormalize ]
 .RB [ \-outsize
 .IR size-in-characters ]
 .RB [ \-bufsize
 .RB [ \-outsize
 .IR size-in-characters ]
 .RB [ \-bufsize
@@ -207,15 +206,6 @@ and only applies if
 is in effect.
 .PP
 The
 is in effect.
 .PP
 The
-.B \-normalize
-and
-.B \-nonormalize
-switches control whether or not email addresses are normalized by the
-address parsing routines.  This is only functional when in address
-mode and is designed to replicate the switch of the same name to
-.IR ap (8).
-.PP
-The
 .B \-outsize
 switch controls the maximum number of printable characters that the format
 engine will produce.  Characters marked as non-printing by the format
 .B \-outsize
 switch controls the maximum number of printable characters that the format
 engine will produce.  Characters marked as non-printing by the format
index e5b2052004f74c143915e1d9899ac237569c8e28..b2079bd288e4f7aa28f0ab4de481bf9829d0fb2d 100644 (file)
@@ -104,35 +104,32 @@ getname (const char *addrs)
 
 
 struct mailname *
 
 
 struct mailname *
-getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
+getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize)
 {
     char *pp;
     struct mailname *mp;
 
     if (err[0]) {
 {
     char *pp;
     struct mailname *mp;
 
     if (err[0]) {
-       if (eresult)
-           strcpy (eresult, err);
-       else
-           if (wanthost == AD_HOST)
-               admonish (NULL, "bad address '%s' - %s", str, err);
+       if (eresult) {
+           strncpy (eresult, err, eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
     if (pers == NULL
            && mbox == NULL && host == NULL && route == NULL
            && grp == NULL) {
        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);
+       if (eresult) {
+           strncpy (eresult, "null address", eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
     if (mbox == NULL && grp == NULL) {
        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);
+       if (eresult) {
+           strncpy (eresult, "no mailbox in address", eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
 
        return NULL;
     }
 
@@ -143,11 +140,11 @@ getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
 
     mp = (struct mailname *) calloc ((size_t) 1, sizeof(*mp));
     if (mp == NULL) {
 
     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");
+       if (eresult) {
+           strncpy (eresult, "insufficient memory to represent address",
+                    eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
 
        return NULL;
     }
 
@@ -317,7 +314,7 @@ ismymbox (struct mailname *np)
                return 0;
            }
 
                return 0;
            }
 
-           if ((mq.m_next = getm (cp, NULL, 0, AD_NAME, NULL)) == NULL) {
+           if ((mq.m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
                admonish (NULL, "invalid entry in local-mailbox: %s", cp);
                return 0;
            }
                admonish (NULL, "invalid entry in local-mailbox: %s", cp);
                return 0;
            }
@@ -337,7 +334,7 @@ ismymbox (struct mailname *np)
            mp = mq.m_next ? mq.m_next : &mq;
            oops = 0;
            while ((cp = getname (am))) {
            mp = mq.m_next ? mq.m_next : &mq;
            oops = 0;
            while ((cp = getname (am))) {
-               if ((mp->m_next = getm (cp, NULL, 0, AD_NAME, NULL)) == NULL) {
+               if ((mp->m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
                    admonish (NULL, "illegal address: %s", cp);
                    oops++;
                } else {
                    admonish (NULL, "illegal address: %s", cp);
                    oops++;
                } else {
index 953f6e5c436dc187a4435b202e5e39d37c402cdb..537a275e345c14e8535d50ce2b1fbbeffca66f75 100644 (file)
@@ -550,6 +550,7 @@ field_encode_address(const char *name, char **value, int encoding,
     char *tmpbuf = NULL;
     size_t tmpbufsize = 0;
     struct mailname *mn;
     char *tmpbuf = NULL;
     size_t tmpbufsize = 0;
     struct mailname *mn;
+    char errbuf[BUFSIZ];
 
     /*
      * Because these are addresses, we need to handle them individually.
 
     /*
      * Because these are addresses, we need to handle them individually.
@@ -566,7 +567,8 @@ field_encode_address(const char *name, char **value, int encoding,
     output = add(" ", output);
 
     for (groupflag = 0; (mp = getname(*value)); ) {
     output = add(" ", output);
 
     for (groupflag = 0; (mp = getname(*value)); ) {
-       if ((mn = getm(mp, NULL, 0, AD_HOST, NULL)) == NULL) {
+       if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
+           advise(mp, "%s", errbuf);
            errflag++;
            continue;
        }
            errflag++;
            continue;
        }
index 3186deaa053deacc887025131f183cda662a1169..07c0cecfdf16213513409119d7d48ed9e5d6a458 100644 (file)
@@ -82,7 +82,7 @@ formataddr (char *orig, char *str)
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (str)); ) {
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (str)); ) {
-       if ((mp = getm (cp, NULL, 0, fmt_norm, NULL)) == NULL)
+       if ((mp = getm (cp, NULL, 0, NULL, 0)) == NULL)
            continue;
 
        if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
            continue;
 
        if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
diff --git a/sbr/fmt_def.c b/sbr/fmt_def.c
deleted file mode 100644 (file)
index 1edb787..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-/*
- * fmt_def.c -- some defines for sbr/fmt_scan.c
- *
- * This code is Copyright (c) 2002, by the authors of nmh.  See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
-
-#include <h/addrsbr.h>
-
-int fmt_norm = AD_NAME;
index 408b1093a86786beea9e309077867d4b82b2078f..a7ad1249068b8193150fd08ceb5174b3ceebc740 100644 (file)
@@ -25,7 +25,6 @@
 #  include <wchar.h>
 #endif
 
 #  include <wchar.h>
 #endif
 
-extern int fmt_norm;           /* defined in sbr/fmt_def.c = AD_NAME */
 struct mailname fmt_mnull = { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0,
                              NULL, NULL };
 
 struct mailname fmt_mnull = { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0,
                              NULL, NULL };
 
@@ -987,7 +986,7 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat,
            if (comp->c_mn != &fmt_mnull)
                mnfree (comp->c_mn);
            if ((sp = comp->c_text) && (sp = getname(sp)) &&
            if (comp->c_mn != &fmt_mnull)
                mnfree (comp->c_mn);
            if ((sp = comp->c_text) && (sp = getname(sp)) &&
-               (mn = getm (sp, NULL, 0, fmt_norm, NULL))) {
+               (mn = getm (sp, NULL, 0, NULL, 0))) {
                comp->c_mn = mn;
                while (getname(""))
                    ;
                comp->c_mn = mn;
                while (getname(""))
                    ;
@@ -1009,7 +1008,7 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat,
            if (comp->c_mn != &fmt_mnull)
                mnfree (comp->c_mn);
            if ((sp = comp->c_text) && (sp = getname(sp)) &&
            if (comp->c_mn != &fmt_mnull)
                mnfree (comp->c_mn);
            if ((sp = comp->c_text) && (sp = getname(sp)) &&
-               (mn = getm (sp, NULL, 0, AD_NAME, NULL))) {
+               (mn = getm (sp, NULL, 0, NULL, 0))) {
                comp->c_mn = mn;
                if (ismymbox(mn))
                    comp->c_flags |= CF_TRUE;
                comp->c_mn = mn;
                if (ismymbox(mn))
                    comp->c_flags |= CF_TRUE;
@@ -1017,7 +1016,7 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat,
                    comp->c_flags &= ~CF_TRUE;
                while ((sp = getname(sp)))
                    if ((comp->c_flags & CF_TRUE) == 0 &&
                    comp->c_flags &= ~CF_TRUE;
                while ((sp = getname(sp)))
                    if ((comp->c_flags & CF_TRUE) == 0 &&
-                       (mn = getm (sp, NULL, 0, AD_NAME, NULL)))
+                       (mn = getm (sp, NULL, 0, NULL, 0)))
                        if (ismymbox(mn))
                            comp->c_flags |= CF_TRUE;
            } else {
                        if (ismymbox(mn))
                            comp->c_flags |= CF_TRUE;
            } else {
index 4079790df05a4eb3803411a47b0a6dd16300fa65..4f25ef60b0b8d8be039d878791fc86e19bba9887 100755 (executable)
@@ -31,7 +31,6 @@ Usage: ali [switches] aliases ...
   switches are:
   -alias aliasfile
   -[no]list
   switches are:
   -alias aliasfile
   -[no]list
-  -[no]normalize
   -[no]user
   -version
   -help
   -[no]user
   -version
   -help
index 1fa7ef848bca3166fec90df8ce98b3904cc94c2b..dda0a2c1f5907a1d27c4c0342e7027843f36c572 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -18,8 +18,6 @@
     X("noalias", -7, NALIASW) \
     X("list", 0, LISTSW) \
     X("nolist", 0, NLISTSW) \
     X("noalias", -7, NALIASW) \
     X("list", 0, LISTSW) \
     X("nolist", 0, NLISTSW) \
-    X("normalize", 0, NORMSW) \
-    X("nonormalize", 0, NNORMSW) \
     X("user", 0, USERSW) \
     X("nouser", 0, NUSERSW) \
     X("version", 0, VERSIONSW) \
     X("user", 0, USERSW) \
     X("nouser", 0, NUSERSW) \
     X("version", 0, VERSIONSW) \
@@ -41,14 +39,14 @@ extern struct aka *akahead;
  * prototypes
  */
 static void print_aka (char *, int, int);
  * prototypes
  */
 static void print_aka (char *, int, int);
-static void print_usr (char *, int, int);
+static void print_usr (char *, int);
 
 
 int
 main (int argc, char **argv)
 {
     int i, vecp = 0, inverted = 0, list = 0;
 
 
 int
 main (int argc, char **argv)
 {
     int i, vecp = 0, inverted = 0, list = 0;
-    int noalias = 0, normalize = AD_NHST;
+    int noalias = 0;
     char *cp, **ap, **argp, buf[BUFSIZ];
     /* Really only need to allocate for argc-1, but must allocate at least 1,
        so go ahead and allocate for argc char pointers. */
     char *cp, **ap, **argp, buf[BUFSIZ];
     /* Really only need to allocate for argc-1, but must allocate at least 1,
        so go ahead and allocate for argc char pointers. */
@@ -102,13 +100,6 @@ main (int argc, char **argv)
                    list = 0;
                    continue;
 
                    list = 0;
                    continue;
 
-               case NORMSW: 
-                   normalize = AD_HOST;
-                   continue;
-               case NNORMSW: 
-                   normalize = AD_NHST;
-                   continue;
-
                case USERSW: 
                    inverted++;
                    continue;
                case USERSW: 
                    inverted++;
                    continue;
@@ -150,7 +141,7 @@ main (int argc, char **argv)
                   invo_name);
 
        for (i = 0; i < vecp; i++)
                   invo_name);
 
        for (i = 0; i < vecp; i++)
-           print_usr (vec[i], list, normalize);
+           print_usr (vec[i], list);
     } else {
        if (vecp) {
            /* print specified aliases */
     } else {
        if (vecp) {
            /* print specified aliases */
@@ -212,7 +203,7 @@ print_aka (char *p, int list, int margin)
 }
 
 static void
 }
 
 static void
-print_usr (char *s, int list, int norm)
+print_usr (char *s, int list)
 {
     register char *cp, *pp, *vp;
     register struct aka *ak;
 {
     register char *cp, *pp, *vp;
     register struct aka *ak;
@@ -220,7 +211,7 @@ print_usr (char *s, int list, int norm)
 
     if ((pp = getname (s)) == NULL)
        adios (NULL, "no address in \"%s\"", s);
 
     if ((pp = getname (s)) == NULL)
        adios (NULL, "no address in \"%s\"", s);
-    if ((mp = getm (pp, NULL, 0, norm, NULL)) == NULL)
+    if ((mp = getm (pp, NULL, 0, NULL, 0)) == NULL)
        adios (NULL, "bad address \"%s\"", s);
     while (getname (""))
        continue;
        adios (NULL, "bad address \"%s\"", s);
     while (getname (""))
        continue;
@@ -229,7 +220,7 @@ print_usr (char *s, int list, int norm)
     for (ak = akahead; ak; ak = ak->ak_next) {
        pp = akresult (ak);
        while ((cp = getname (pp))) {
     for (ak = akahead; ak; ak = ak->ak_next) {
        pp = akresult (ak);
        while ((cp = getname (pp))) {
-           if ((np = getm (cp, NULL, 0, norm, NULL)) == NULL)
+           if ((np = getm (cp, NULL, 0, NULL, 0)) == NULL)
                continue;
            if (!strcasecmp (mp->m_host ? mp->m_host : "",
                             np->m_host ? np->m_host : "")  &&
                continue;
            if (!strcasecmp (mp->m_host ? mp->m_host : "",
                             np->m_host ? np->m_host : "")  &&
index 2e83d07c2389ad8ca744e821637fe89730e3b352..6600f741374247b7d6aacdb47c0c0260d39277b5 100644 (file)
@@ -126,7 +126,7 @@ akval (struct aka *ak, char *s)
            if (name) {
                /* s is of the form "Blind list: address".  If address
                   is an alias, expand it. */
            if (name) {
                /* s is of the form "Blind list: address".  If address
                   is an alias, expand it. */
-               struct mailname *mp = getm (name, NULL, 0, AD_NAME, NULL);
+               struct mailname *mp = getm (name, NULL, 0, NULL, 0);
 
                if (mp  &&  mp->m_ingrp) {
                    char *gname = add (mp->m_gname, NULL);
 
                if (mp  &&  mp->m_ingrp) {
                    char *gname = add (mp->m_gname, NULL);
index c42d732c858c49ac659b3acf30d8e92eef19c56e..f0b0baa98f3e408c80f22c1f3a402918b12710a2 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -22,8 +22,6 @@
 #define AP_SWITCHES \
     X("form formatfile", 0, FORMSW) \
     X("format string", 5, FMTSW) \
 #define AP_SWITCHES \
     X("form formatfile", 0, FORMSW) \
     X("format string", 5, FMTSW) \
-    X("normalize", 0, NORMSW) \
-    X("nonormalize", 0, NNORMSW) \
     X("width columns", 0, WIDTHSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     X("width columns", 0, WIDTHSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
@@ -43,13 +41,13 @@ static int dat[5];
 /*
  * static prototypes
  */
 /*
  * static prototypes
  */
-static int process (char *, int, int);
+static int process (char *, int);
 
 
 int
 main (int argc, char **argv)
 {
 
 
 int
 main (int argc, char **argv)
 {
-    int addrp = 0, normalize = AD_HOST;
+    int addrp = 0;
     int width = 0, status = 0;
     char *cp, *form = NULL, *format = NULL, *nfs;
     char buf[BUFSIZ], **argp;
     int width = 0, status = 0;
     char *cp, *form = NULL, *format = NULL, *nfs;
     char buf[BUFSIZ], **argp;
@@ -102,13 +100,6 @@ main (int argc, char **argv)
                        adios (NULL, "missing argument to %s", argp[-2]);
                    width = atoi (cp);
                    continue;
                        adios (NULL, "missing argument to %s", argp[-2]);
                    width = atoi (cp);
                    continue;
-
-               case NORMSW: 
-                   normalize = AD_HOST;
-                   continue;
-               case NNORMSW: 
-                   normalize = AD_NHST;
-                   continue;
            }
        }
        if (addrp > NADDRS)
            }
        }
        if (addrp > NADDRS)
@@ -131,7 +122,6 @@ main (int argc, char **argv)
     }
     if (width > WBUFSIZ)
        width = WBUFSIZ;
     }
     if (width > WBUFSIZ)
        width = WBUFSIZ;
-    fmt_norm = normalize;
     fmt_compile (nfs, &fmt, 1);
 
     dat[0] = 0;
     fmt_compile (nfs, &fmt, 1);
 
     dat[0] = 0;
@@ -141,7 +131,7 @@ main (int argc, char **argv)
     dat[4] = 0;
 
     for (addrp = 0; addrs[addrp]; addrp++)
     dat[4] = 0;
 
     for (addrp = 0; addrs[addrp]; addrp++)
-       status += process (addrs[addrp], width, normalize);
+       status += process (addrs[addrp], width);
 
     fmt_free (fmt, 1);
     done (status);
 
     fmt_free (fmt, 1);
     done (status);
@@ -156,7 +146,7 @@ struct pqpair {
 
 
 static int
 
 
 static int
-process (char *arg, int length, int norm)
+process (char *arg, int length)
 {
     int        status = 0;
     register char *cp;
 {
     int        status = 0;
     register char *cp;
@@ -170,7 +160,7 @@ process (char *arg, int length, int norm)
     while ((cp = getname (arg))) {
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
     while ((cp = getname (arg))) {
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
-       if ((mp = getm (cp, NULL, 0, norm, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
            status++;
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
            status++;
index 4794c7bf377e5d02ee572f67b55b7f490b8f57c6..2bcebd7a557c1faa3d2a5683a6ea7868b7ba5b98 100644 (file)
@@ -28,8 +28,6 @@
     X("nodupaddrs", 0, NDUPADDRSW) \
     X("ccme", 0, CCMESW) \
     X("noccme", 0, NCCMESW) \
     X("nodupaddrs", 0, NDUPADDRSW) \
     X("ccme", 0, CCMESW) \
     X("noccme", 0, NCCMESW) \
-    X("normalize", 0, NORMSW) \
-    X("nonormalize", 0, NNORMSW) \
     X("outsize size-in-characters", 0, OUTSIZESW) \
     X("bufsize size-in-bytes", 0, BUFSZSW) \
     X("width column-width", 0, WIDTHSW) \
     X("outsize size-in-characters", 0, OUTSIZESW) \
     X("bufsize size-in-bytes", 0, BUFSZSW) \
     X("width column-width", 0, WIDTHSW) \
@@ -88,7 +86,7 @@ static char *c_flagsstr(int);
 static void litputs(char *);
 static void litputc(char);
 static void process_addresses(struct format *, struct msgs_array *, char *,
 static void litputs(char *);
 static void litputc(char);
 static void process_addresses(struct format *, struct msgs_array *, char *,
-                             int, int, int *, int, struct fmt_callbacks *);
+                             int, int, int *, struct fmt_callbacks *);
 static void process_raw(struct format *, struct msgs_array *, char *,
                        int, int, int *, struct fmt_callbacks *);
 static void process_messages(struct format *, struct msgs_array *,
 static void process_raw(struct format *, struct msgs_array *, char *,
                        int, int, int *, struct fmt_callbacks *);
 static void process_messages(struct format *, struct msgs_array *,
@@ -119,7 +117,6 @@ main (int argc, char **argv)
     int dump = 0, i;
     int outputsize = 0, bufsize = 0, dupaddrs = 1, trace = 0, files = 0;
     int colwidth = -1, msgnum = -1, msgcur = -1, msgsize = -1, msgunseen = -1;
     int dump = 0, i;
     int outputsize = 0, bufsize = 0, dupaddrs = 1, trace = 0, files = 0;
     int colwidth = -1, msgnum = -1, msgcur = -1, msgsize = -1, msgunseen = -1;
-    int normalize = AD_HOST;
     enum mode_t mode = MESSAGE;
     int dat[5];
     struct fmt_callbacks cb, *cbp = NULL;
     enum mode_t mode = MESSAGE;
     int dat[5];
     struct fmt_callbacks cb, *cbp = NULL;
@@ -196,13 +193,6 @@ main (int argc, char **argv)
                    form = NULL;
                    continue;
 
                    form = NULL;
                    continue;
 
-               case NORMSW:
-                   normalize = AD_HOST;
-                   continue;
-               case NNORMSW:
-                   normalize = AD_NHST;
-                   continue;
-
                case TRACESW:
                    trace++;
                    continue;
                case TRACESW:
                    trace++;
                    continue;
@@ -403,9 +393,8 @@ main (int argc, char **argv)
        }
 
        if (mode == ADDRESS) {
        }
 
        if (mode == ADDRESS) {
-           fmt_norm = normalize;
            process_addresses(fmt, &msgs, buffer, bufsize, outputsize,
            process_addresses(fmt, &msgs, buffer, bufsize, outputsize,
-                             dat, normalize, cbp);
+                             dat, cbp);
        } else /* Fall-through for RAW or DATE */
            process_raw(fmt, &msgs, buffer, bufsize, outputsize, dat, cbp);
     }
        } else /* Fall-through for RAW or DATE */
            process_raw(fmt, &msgs, buffer, bufsize, outputsize, dat, cbp);
     }
@@ -428,8 +417,7 @@ struct pqpair {
 
 static void
 process_addresses(struct format *fmt, struct msgs_array *addrs, char *buffer,
 
 static void
 process_addresses(struct format *fmt, struct msgs_array *addrs, char *buffer,
-                 int bufsize, int outwidth, int *dat, int norm,
-                 struct fmt_callbacks *cb)
+                 int bufsize, int outwidth, int *dat, struct fmt_callbacks *cb)
 {
     int i;
     char *cp, error[BUFSIZ];
 {
     int i;
     char *cp, error[BUFSIZ];
@@ -452,7 +440,7 @@ process_addresses(struct format *fmt, struct msgs_array *addrs, char *buffer,
        while ((cp = getname(addrs->msgs[i]))) {
            if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
                adios (NULL, "unable to allocate pqpair memory");
        while ((cp = getname(addrs->msgs[i]))) {
            if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
                adios (NULL, "unable to allocate pqpair memory");
-           if ((mp = getm(cp, NULL, 0, norm, error)) == NULL) {
+           if ((mp = getm(cp, NULL, 0, error, sizeof(error))) == NULL) {
                p->pq_text = getcpy(cp);
                p->pq_error = getcpy(error);
            } else {
                p->pq_text = getcpy(cp);
                p->pq_error = getcpy(error);
            } else {
@@ -1280,7 +1268,7 @@ test_formataddr (char *orig, char *str)
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (str)); ) {
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (str)); ) {
-       if ((mp = getm (cp, NULL, 0, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            fprintf(stderr, "bad address \"%s\" -- %s\n", cp, error);
            continue;
        }
            fprintf(stderr, "bad address \"%s\" -- %s\n", cp, error);
            continue;
        }
index 8d759d654b786209ba7448fc0001d0cbcfab9927..6854ab991e560f4db6390822ca0e4444d6604e47 100644 (file)
@@ -1180,7 +1180,7 @@ mcomp_format (struct mcomp *c1, struct mcomp *c2)
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
 
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
 
-       if ((mp = getm (cp, NULL, 0, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
        } else {
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
        } else {
index 679ae6dfe49807e2e1353d26476200792eecf180..858946354ba2e55a5ec7e0c2242cf1720e3e519e 100644 (file)
@@ -669,7 +669,7 @@ putfmt (char *name, char *str, FILE *out)
 {
     int count, grp, i, keep;
     char *cp, *pp, *qp;
 {
     int count, grp, i, keep;
     char *cp, *pp, *qp;
-    char namep[BUFSIZ];
+    char namep[BUFSIZ], error[BUFSIZ];
     struct mailname *mp = NULL, *np = NULL;
     struct headers *hdr;
 
     struct mailname *mp = NULL, *np = NULL;
     struct headers *hdr;
 
@@ -732,18 +732,20 @@ putfmt (char *name, char *str, FILE *out)
 
     tmpaddrs.m_next = NULL;
     for (count = 0; (cp = getname (str)); count++)
 
     tmpaddrs.m_next = NULL;
     for (count = 0; (cp = getname (str)); count++)
-       if ((mp = getm (cp, NULL, 0, AD_HOST, NULL))) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error)))) {
            if (tmpaddrs.m_next)
                np->m_next = mp;
            else
                tmpaddrs.m_next = mp;
            np = mp;
        }
            if (tmpaddrs.m_next)
                np->m_next = mp;
            else
                tmpaddrs.m_next = mp;
            np = mp;
        }
-       else
+       else {
+           admonish(cp, "%s", error);
            if (hdr->flags & HTRY)
                badadr++;
            else
                badmsg++;
            if (hdr->flags & HTRY)
                badadr++;
            else
                badmsg++;
+       }
 
     if (count < 1) {
        if (hdr->flags & HNIL)
 
     if (count < 1) {
        if (hdr->flags & HNIL)
@@ -784,7 +786,8 @@ putfmt (char *name, char *str, FILE *out)
            if (np->m_gname)
                putgrp (namep, np->m_gname, out, hdr->flags);
            while ((cp = getname (pp))) {
            if (np->m_gname)
                putgrp (namep, np->m_gname, out, hdr->flags);
            while ((cp = getname (pp))) {
-               if (!(mp = getm (cp, NULL, 0, AD_HOST, NULL))) {
+               if (!(mp = getm (cp, NULL, 0, error, sizeof(error)))) {
+                   admonish(cp, "%s", error);
                    badadr++;
                    continue;
                }
                    badadr++;
                    continue;
                }
index ee404efd7118bff11ae4eeb4a5a51cab4af6a61c..6a906b44b838a98c9dbf062916890517debd83fe 100644 (file)
@@ -317,7 +317,7 @@ replformataddr (char *orig, char *str)
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (fixed_str)); ) {
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (fixed_str)); ) {
-       if ((mp = getm (cp, dfhost, dftype, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, dfhost, dftype, error, sizeof(error))) == NULL) {
            snprintf (baddr, sizeof(baddr), "\t%s -- %s\n", cp, error);
            badaddrs = add (baddr, badaddrs);
            continue;
            snprintf (baddr, sizeof(baddr), "\t%s -- %s\n", cp, error);
            badaddrs = add (baddr, badaddrs);
            continue;
@@ -523,7 +523,8 @@ fix_addresses (char *str) {
             adr_nodep->next = NULL;
 
             /* With AD_NAME, errors are not reported to user. */
             adr_nodep->next = NULL;
 
             /* With AD_NAME, errors are not reported to user. */
-            if ((mp = getm (cp, dfhost, dftype, AD_NAME, error)) == NULL) {
+            if ((mp = getm (cp, dfhost, dftype, error,
+                           sizeof(error))) == NULL) {
                 const char *no_at_sign = "no at-sign after local-part";
 
                 adr_nodep->escape_local_part =
                 const char *no_at_sign = "no at-sign after local-part";
 
                 adr_nodep->escape_local_part =
@@ -562,7 +563,7 @@ fix_addresses (char *str) {
                 new_adr = concat (display_name, " ", angle_addr, NULL);
                 adr = getname (new_adr);
                 if (adr != NULL  &&
                 new_adr = concat (display_name, " ", angle_addr, NULL);
                 adr = getname (new_adr);
                 if (adr != NULL  &&
-                    (mp = getm (adr, dfhost, dftype, AD_NAME, NULL)) != NULL) {
+                    (mp = getm (adr, dfhost, dftype, NULL, 0)) != NULL) {
                     fixed_address = 1;
                     mnfree (mp);
                 }
                     fixed_address = 1;
                     mnfree (mp);
                 }