From: Ken Hornstein Date: Wed, 2 Oct 2019 15:39:21 +0000 (-0400) Subject: Remove X.400 address parsing X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/9ef6b510ada8a7d3b053ebaef0686570ebf00f63?hp=d4d461d0dcbd3387fa5e372956035fb5fdb0d233 Remove X.400 address parsing Remove the X.400 address parsing used by the %(friendly) format escape. Because ... you know, it's 2019 and X.400. --- diff --git a/man/mh-format.man b/man/mh-format.man index 09d589e0..22233b65 100644 --- a/man/mh-format.man +++ b/man/mh-format.man @@ -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 -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 diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index c5e9877c..f0803d25 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -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 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" }; -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) @@ -975,8 +929,7 @@ fmt_scan (struct format *format, charstring_t scanlp, int width, int *dat, 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: