]> diplodocus.org Git - nmh/commitdiff
Remove X.400 address parsing
authorKen Hornstein <kenh@pobox.com>
Wed, 2 Oct 2019 15:39:21 +0000 (11:39 -0400)
committerKen Hornstein <kenh@pobox.com>
Wed, 2 Oct 2019 15:40:52 +0000 (11:40 -0400)
Remove the X.400 address parsing used by the %(friendly) format escape.
Because ... you know, it's 2019 and X.400.

man/mh-format.man
sbr/fmt_scan.c

index 09d589e049e420345d87764d93ea8fb0f5699c9c..22233b65b0860e8a0937ce64cb24dd0e4d48db4e 100644 (file)
@@ -419,9 +419,7 @@ The \fIfriendly\fR\^{\fIcomp\fR\^}) call will return any double-quoted
 \*(lqpersonal name\*(rq (that is, anything before <>), then it will return
 that.  If there's no personal name but there is a
 \*(lqnote\*(rq (comments string after an email address), it will return
 \*(lqpersonal name\*(rq (that is, anything before <>), then it will return
 that.  If there's no personal name but there is a
 \*(lqnote\*(rq (comments string after an email address), it will return
-that.  If there is neither of those, it will try to parse the email address as an X400 directory
-name and try to extract out a few of the fields from it to return. If that
-fails (likely, as X400 is long dead) it will just return the bare email address.
+that.  If there is neither of those it will just return the bare email address.
 
 .SS Formatting
 When a function or component escape is interpreted and the result will
 
 .SS Formatting
 When a function or component escape is interpreted and the result will
index c5e9877cc47ae2827d9756395a06182022ec457b..f0803d2569dc80234cdba07504e8276fe435c16b 100644 (file)
@@ -39,8 +39,6 @@ struct mailname fmt_mnull = { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0,
  * static prototypes
  */
 static int match (char *, char *) PURE;
  * static prototypes
  */
 static int match (char *, char *) PURE;
-static char *get_x400_friendly (char *, char *, int);
-static int get_x400_comp (char *, char *, char *, int);
 
 
 /*
 
 
 /*
@@ -357,50 +355,6 @@ static char *lmonth[] = { "January",  "February","March",   "April",
                          "May",      "June",    "July",    "August",
                          "September","October", "November","December" };
 
                          "May",      "June",    "July",    "August",
                          "September","October", "November","December" };
 
-static char *
-get_x400_friendly (char *mbox, char *buffer, int buffer_len)
-{
-    char given[BUFSIZ], surname[BUFSIZ];
-
-    if (mbox == NULL)
-       return NULL;
-    if (*mbox == '"')
-       mbox++;
-    if (*mbox != '/')
-       return NULL;
-
-    if (get_x400_comp (mbox, "/PN=", buffer, buffer_len)) {
-       for (mbox = buffer; (mbox = strchr(mbox, '.')); )
-           *mbox++ = ' ';
-
-       return buffer;
-    }
-
-    if (!get_x400_comp (mbox, "/S=", surname, sizeof(surname)))
-       return NULL;
-
-    if (get_x400_comp (mbox, "/G=", given, sizeof(given)))
-       snprintf (buffer, buffer_len, "%s %s", given, surname);
-    else
-       snprintf (buffer, buffer_len, "%s", surname);
-
-    return buffer;
-}
-
-static int
-get_x400_comp (char *mbox, char *key, char *buffer, int buffer_len)
-{
-    int        idx;
-    char *cp;
-
-    if ((idx = stringdex (key, mbox)) < 0
-           || !(cp = strchr(mbox += idx + strlen (key), '/')))
-       return 0;
-
-    snprintf (buffer, buffer_len, "%*.*s", (int)(cp - mbox), (int)(cp - mbox), mbox);
-    return 1;
-}
-
 struct format *
 fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat,
          struct fmt_callbacks *callbacks)
 struct format *
 fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat,
          struct fmt_callbacks *callbacks)
@@ -975,8 +929,7 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat,
                                break;
                    }
                     str = memmove(buffer, str, strlen(str) + 1);
                                break;
                    }
                     str = memmove(buffer, str, strlen(str) + 1);
-               } else if (!(str = get_x400_friendly (mn->m_mbox,
-                               buffer, sizeof(buffer)))) {
+               } else {
        unfriendly:
                  switch (mn->m_type) {
                    case LOCALHOST:
        unfriendly:
                  switch (mn->m_type) {
                    case LOCALHOST: