Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/news/trn news/trn: Add patch with date grammar rules f...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/672285f6ab87
branches:  trunk
changeset: 435319:672285f6ab87
user:      rhialto <rhialto%pkgsrc.org@localhost>
date:      Sun Jul 05 13:35:31 2020 +0000

description:
news/trn: Add patch with date grammar rules for old articles from olduse.net.

diffstat:

 news/trn/Makefile                  |    4 +-
 news/trn/distinfo                  |    3 +-
 news/trn/patches/patch-parsedate.y |  109 +++++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+), 3 deletions(-)

diffs (141 lines):

diff -r bd40302d455c -r 672285f6ab87 news/trn/Makefile
--- a/news/trn/Makefile Sun Jul 05 12:23:43 2020 +0000
+++ b/news/trn/Makefile Sun Jul 05 13:35:31 2020 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.47 2020/03/20 11:58:13 nia Exp $
+# $NetBSD: Makefile,v 1.48 2020/07/05 13:35:31 rhialto Exp $
 
 DISTNAME=              trn-4.0-test77
 PKGNAME=               trn-4.77
-PKGREVISION=           3
+PKGREVISION=           4
 CATEGORIES=            news
 MASTER_SITES=          ${MASTER_SITE_SOURCEFORGE:=trn/}
 
diff -r bd40302d455c -r 672285f6ab87 news/trn/distinfo
--- a/news/trn/distinfo Sun Jul 05 12:23:43 2020 +0000
+++ b/news/trn/distinfo Sun Jul 05 13:35:31 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.15 2015/11/02 23:49:48 agc Exp $
+$NetBSD: distinfo,v 1.16 2020/07/05 13:35:31 rhialto Exp $
 
 SHA1 (trn-4.0-test77.tar.gz) = de43b0ac38e6d921c6f3fa55c8b5b948ac034e8e
 RMD160 (trn-4.0-test77.tar.gz) = 291a8ded5ebbf2724f132e52b77db84b3079371d
@@ -7,3 +7,4 @@
 SHA1 (patch-ac) = b6e06444f55242c1fe0dac194e04cd2c5f6a4c53
 SHA1 (patch-ad) = f6d102af2b6e3095ea765f622085464193d94835
 SHA1 (patch-ae) = 6cc777ff94540345a433e88ab355fe18a23d60d1
+SHA1 (patch-parsedate.y) = 99213bd37f0708b65276a1f920b757a65ba29b33
diff -r bd40302d455c -r 672285f6ab87 news/trn/patches/patch-parsedate.y
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/news/trn/patches/patch-parsedate.y        Sun Jul 05 13:35:31 2020 +0000
@@ -0,0 +1,109 @@
+$NetBSD: patch-parsedate.y,v 1.1 2020/07/05 13:35:31 rhialto Exp $
+
+Add date grammar rules for old articles from olduse.net.
+
+--- parsedate.y.orig   2000-05-27 00:31:17.000000000 +0000
++++ parsedate.y
+@@ -134,6 +134,10 @@ item      : time {
+       | rel {
+           yyHaveRel = 1;
+       }
++      | unixdatestamp {
++          yyHaveTime++;
++          yyHaveDate++;
++      }
+       ;
+ 
+ time  : tUNUMBER o_merid {
+@@ -259,6 +263,24 @@ date      : tUNUMBER '/' tUNUMBER {
+           yyMonth = $4;
+           yyYear = $5;
+       }
++      /* Sun, 5-May-85 13:39:01 EDT */
++      | tDAY ',' tUNUMBER tMONTH tSNUMBER {
++          /* a loose '-' disappears, and -85 becomes a single number */
++          yyDay = $3;
++          yyMonth = $4;
++          yyYear = -$5;
++          if (yyYear < 0)
++              yyYear = -yyYear;
++      }
++      /* 5-May-85 13:39:01 EDT */
++      | tUNUMBER tMONTH tSNUMBER {
++          /* a loose '-' disappears, and -85 becomes a single number */
++          yyDay = $1;
++          yyMonth = $2;
++          yyYear = -$3;
++          if (yyYear < 0)
++              yyYear = -yyYear;
++      }
+       ;
+ 
+ rel   : tSNUMBER tSEC_UNIT {
+@@ -283,6 +305,21 @@ o_merid   : /* NULL */ {
+       }
+       ;
+ 
++      /* Sat Apr 24 10:49:30 1982 */
++unixdatestamp: tDAY tMONTH tUNUMBER udtime tUNUMBER {
++          yyDay = $3;
++          yyMonth = $2;
++          yyYear = $5;
++      }
++      ;
++
++udtime        : tUNUMBER ':' tUNUMBER ':' tUNUMBER {
++          yyHour = $1;
++          yyMinutes = $3;
++          yySeconds = $5;
++          yyMeridian = MER24;
++          yyDSTmode = DSToff;
++      }
+ %%
+ 
+ /* Month and day table. */
+@@ -692,6 +729,9 @@ date_lex()
+       if (isdigit(c) || c == '-' || c == '+') {
+           if (c == '-' || c == '+') {
+               sign = c == '-' ? -1 : 1;
++#ifdef TEST
++              printf(" A number? %s\n", yyInput);
++#endif
+               yyInput++;
+               if (!isdigit(*yyInput))
+                   /* Skip the plus or minus sign. */
+@@ -703,6 +743,9 @@ date_lex()
+               i = 10 * i + c - '0';
+           yyInput--;
+           yylval.Number = sign < 0 ? -i : i;
++#ifdef TEST
++          printf(" A number? => %d %s\n", yylval.Number, yyInput);
++#endif
+           return sign ? tSNUMBER : tUNUMBER;
+       }
+ 
+@@ -713,9 +756,15 @@ date_lex()
+                   *p++ = isupper(c) ? tolower(c) : c;
+           *p = '\0';
+           yyInput--;
++#ifdef TEST
++          printf(" A word: %s %s\n", buff, yyInput);
++#endif
+           return LookupWord(buff, p - buff);
+       }
+ 
++#ifdef TEST
++      printf(" A char: %s\n", yyInput);
++#endif
+       return *yyInput++;
+     }
+ }
+@@ -799,7 +848,7 @@ main(ac, av)
+           continue;
+       }
+ #endif /* YYDEBUG */
+-      d = parsedate(buff, (TIMEINFO *)NULL);
++      d = parsedate(buff);
+       if (d == -1)
+           (void)printf("Bad format - couldn't convert.\n");
+       else



Home | Main Index | Thread Index | Old Index