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



The following reply was made to PR bin/47453; it has been noted by GNATS.

From: Steffen "Daode" Nurpmeso <sdaoden%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost, martin%martinbrandenburg.com@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: PR/47453 CVS commit: src/usr.bin/mail
Date: Wed, 16 Jan 2013 15:43:39 +0100

 "Christos Zoulas" <christos%netbsd.org@localhost> wrote:
  |The following reply was made to PR bin/47453; it has been noted by GN=
 ATS.
  |
  |From: "Christos Zoulas" <christos%netbsd.org@localhost>
  |To: gnats-bugs%gnats.NetBSD.org@localhost
  |Cc:=20
  |Subject: PR/47453 CVS commit: src/usr.bin/mail
  |Date: Tue, 15 Jan 2013 12:25:42 -0500
  |
  | Module Name:=09src
  | Committed By:=09christos
  | Date:=09=09Tue Jan 15 17:25:42 UTC 2013
  |=20
  | Modified Files:
  | =09src/usr.bin/mail: head.c
  |=20
  | 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=092013-01-16 15:25:41.000000000 +0100
 +++ head.c=092013-01-16 15:30:51.000000000 +0100
 @@ -115,23 +115,42 @@ cmatch(const char *cp, const char *tp)
   * 'N'=09A new line
   * '+'=09A plus or minus sign
   */
 -static const char *datetypes[] =3D {
 - =09"Aaa Aaa O0 00:00:00 0000",=09=09/* BSD ctype */
 -=09"Aaa Aaa O0 00:00 0000",=09=09/* SysV ctype */
 -=09"Aaa Aaa O0 00:00:00 AAA 0000",=09=09/* BSD tmztype */
 -=09"Aaa Aaa O0 00:00 AAA 0000",=09=09/* SysV tmztype */
 -=09"Aaa Aaa O0 00:00:00 0000 +0000",=09/* RFC822 type */
 -=09"Aaa Aaa O0 00:00:00 0000 AAA",=09=09/* RFC822 alttype */
 +static struct cmatch_data {
 +=09size_t=09=09tlen;
 +=09char const=09*tdata;
 +} const=09_cmatch_data[] =3D {
 +=09{ 24, "Aaa Aaa O0 00:00:00 0000" },=09=09/* BSD ctype */
 +=09{ 21, "Aaa Aaa O0 00:00 0000" },=09=09/* SysV ctype */
 +=09{ 28, "Aaa Aaa O0 00:00:00 AAA 0000" },=09=09/* BSD tmztype */
 +=09{ 25, "Aaa Aaa O0 00:00 AAA 0000" },=09=09/* SysV tmztype */
 +=09/*
 +=09 * RFC 822-alike From_ lines do not conform to RFC 4155, but seem t=
 o
 +=09 * be used in the wild by UW-imap (MBX format plus)
 +=09 */
 +=09{ 30, "Aaa Aaa O0 00:00:00 0000 +0000" },=09/* RFC822, UT offset */
 +=09/* RFC 822 with zone spec; 1. military, 2. UT, 3. north america tim=
 e
 +=09 * zone strings; note that 1. is strictly speaking not correct as s=
 ome
 +=09 * letters are not used */
 +=09{ 28 - 2, "Aaa Aaa O0 00:00:00 0000 A" },
 +=09{ 28 - 1, "Aaa Aaa O0 00:00:00 0000 AA" },
 +        { 28 - 0, "Aaa Aaa O0 00:00:00 0000 AAA" },
 +=09{ 0, NULL }
  };
 +#define _CMATCH_MINLEN=0921
 =20
  static int
  isdate(const char date[])
  {
 -
 -=09for (size_t i =3D 0; i < __arraycount(datetypes); i++)
 -=09=09if (cmatch(date, datetypes[i]))
 -=09=09=09return 1;
 -=09return 0;
 +=09struct cmatch_data const *cmdp;
 +=09size_t dl =3D strlen(date);
 +=09int ret =3D 0;
 +
 +=09if (dl >=3D _CMATCH_MINLEN)
 +=09=09for (cmdp =3D _cmatch_data; cmdp->tdata !=3D NULL; ++cmdp)
 +=09=09=09if (dl =3D=3D cmdp->tlen &&
 +=09=09=09=09=09(ret =3D cmatch(date, cmdp->tdata)))
 +=09=09=09=09break;
 +=09return ret;
  }
 =20
  static void
 


Home | Main Index | Thread Index | Old Index