NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: PR/47453 CVS commit: src/usr.bin/mail
"Christos Zoulas" <christos%netbsd.org@localhost> wrote:
|The following reply was made to PR bin/47453; it has been noted by GNATS.
|
|From: "Christos Zoulas" <christos%netbsd.org@localhost>
|To: gnats-bugs%gnats.NetBSD.org@localhost
|Cc:
|Subject: PR/47453 CVS commit: src/usr.bin/mail
|Date: Tue, 15 Jan 2013 12:25:42 -0500
|
| Module Name: src
| Committed By: christos
| Date: Tue Jan 15 17:25:42 UTC 2013
|
| Modified Files:
| src/usr.bin/mail: head.c
|
| Log Message:
| PR/47453: Martin Branderburg: Mail (mail, mailx) does not recognize \
|messages
| which have RFC 822 format dates.
Your commit supports zone-style RFC 822 dates. RFC 5322 marks
this zone-style as obsolete (obs-zone), but still supports it.
But then, even if you don't wanna support military style
single-letter zones, the UT zone exists and will not be supported
by this commit.
I'll append a diff that is not correct (since not all possible
single-letter zones are assigned, and only *UT* has two letters),
but which will match all thre possible *obs-zone* forms.
Compiled and tested on a single MBOX.
Thanks all beside that, my one goofed too.
--steffen
--- head.c.orig 2013-01-16 15:25:41.000000000 +0100
+++ head.c 2013-01-16 15:30:51.000000000 +0100
@@ -115,23 +115,42 @@ cmatch(const char *cp, const char *tp)
* 'N' A new line
* '+' A plus or minus sign
*/
-static const char *datetypes[] = {
- "Aaa Aaa O0 00:00:00 0000", /* BSD ctype */
- "Aaa Aaa O0 00:00 0000", /* SysV ctype */
- "Aaa Aaa O0 00:00:00 AAA 0000", /* BSD tmztype */
- "Aaa Aaa O0 00:00 AAA 0000", /* SysV tmztype */
- "Aaa Aaa O0 00:00:00 0000 +0000", /* RFC822 type */
- "Aaa Aaa O0 00:00:00 0000 AAA", /* RFC822 alttype */
+static struct cmatch_data {
+ size_t tlen;
+ char const *tdata;
+} const _cmatch_data[] = {
+ { 24, "Aaa Aaa O0 00:00:00 0000" }, /* BSD ctype */
+ { 21, "Aaa Aaa O0 00:00 0000" }, /* SysV ctype */
+ { 28, "Aaa Aaa O0 00:00:00 AAA 0000" }, /* BSD tmztype */
+ { 25, "Aaa Aaa O0 00:00 AAA 0000" }, /* SysV tmztype */
+ /*
+ * RFC 822-alike From_ lines do not conform to RFC 4155, but seem to
+ * be used in the wild by UW-imap (MBX format plus)
+ */
+ { 30, "Aaa Aaa O0 00:00:00 0000 +0000" }, /* RFC822, UT offset */
+ /* RFC 822 with zone spec; 1. military, 2. UT, 3. north america time
+ * zone strings; note that 1. is strictly speaking not correct as some
+ * letters are not used */
+ { 28 - 2, "Aaa Aaa O0 00:00:00 0000 A" },
+ { 28 - 1, "Aaa Aaa O0 00:00:00 0000 AA" },
+ { 28 - 0, "Aaa Aaa O0 00:00:00 0000 AAA" },
+ { 0, NULL }
};
+#define _CMATCH_MINLEN 21
static int
isdate(const char date[])
{
-
- for (size_t i = 0; i < __arraycount(datetypes); i++)
- if (cmatch(date, datetypes[i]))
- return 1;
- return 0;
+ struct cmatch_data const *cmdp;
+ size_t dl = strlen(date);
+ int ret = 0;
+
+ if (dl >= _CMATCH_MINLEN)
+ for (cmdp = _cmatch_data; cmdp->tdata != NULL; ++cmdp)
+ if (dl == cmdp->tlen &&
+ (ret = cmatch(date, cmdp->tdata)))
+ break;
+ return ret;
}
static void
Home |
Main Index |
Thread Index |
Old Index