Sat Apr 23 13:02:04 2022 UTC ()
fix date -d 12/01/2022, found by Anon Ymous


(christos)
diff -r1.36 -r1.37 src/lib/libutil/parsedate.y

cvs diff -r1.36 -r1.37 src/lib/libutil/parsedate.y (expand / switch to unified diff)

--- src/lib/libutil/parsedate.y 2020/10/30 22:03:11 1.36
+++ src/lib/libutil/parsedate.y 2022/04/23 13:02:04 1.37
@@ -4,27 +4,27 @@ @@ -4,27 +4,27 @@
4** at the University of North Carolina at Chapel Hill. Later tweaked by 4** at the University of North Carolina at Chapel Hill. Later tweaked by
5** a couple of people on Usenet. Completely overhauled by Rich $alz 5** a couple of people on Usenet. Completely overhauled by Rich $alz
6** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990; 6** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
7** 7**
8** This grammar has 10 shift/reduce conflicts. 8** This grammar has 10 shift/reduce conflicts.
9** 9**
10** This code is in the public domain and has no copyright. 10** This code is in the public domain and has no copyright.
11*/ 11*/
12/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */ 12/* SUPPRESS 287 on yaccpar_sccsid *//* Unused static variable */
13/* SUPPRESS 288 on yyerrlab *//* Label unused */ 13/* SUPPRESS 288 on yyerrlab *//* Label unused */
14 14
15#include <sys/cdefs.h> 15#include <sys/cdefs.h>
16#ifdef __RCSID 16#ifdef __RCSID
17__RCSID("$NetBSD: parsedate.y,v 1.36 2020/10/30 22:03:11 kre Exp $"); 17__RCSID("$NetBSD: parsedate.y,v 1.37 2022/04/23 13:02:04 christos Exp $");
18#endif 18#endif
19 19
20#include <stdio.h> 20#include <stdio.h>
21#include <ctype.h> 21#include <ctype.h>
22#include <errno.h> 22#include <errno.h>
23#include <limits.h> 23#include <limits.h>
24#include <string.h> 24#include <string.h>
25#include <time.h> 25#include <time.h>
26#include <util.h> 26#include <util.h>
27#include <stdlib.h> 27#include <stdlib.h>
28 28
29/* NOTES on rebuilding parsedate.c (particularly for inclusion in CVS 29/* NOTES on rebuilding parsedate.c (particularly for inclusion in CVS
30 releases): 30 releases):
@@ -349,27 +349,27 @@ date: @@ -349,27 +349,27 @@ date:
349 if ($1 > 12 || $3 > 31 || $1 == 0 || $3 == 0) 349 if ($1 > 12 || $3 > 31 || $1 == 0 || $3 == 0)
350 YYREJECT; 350 YYREJECT;
351 param->yyMonth = $1; 351 param->yyMonth = $1;
352 param->yyDay = $3; 352 param->yyDay = $3;
353 } 353 }
354 | tUNUMBER '/' tUNUMBER '/' tUNUMBER { 354 | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
355 if ($1 >= 100) { 355 if ($1 >= 100) {
356 if ($3 > 12 || $5 > 31 || $3 == 0 || $5 == 0) 356 if ($3 > 12 || $5 > 31 || $3 == 0 || $5 == 0)
357 YYREJECT; 357 YYREJECT;
358 param->yyYear = $1; 358 param->yyYear = $1;
359 param->yyMonth = $3; 359 param->yyMonth = $3;
360 param->yyDay = $5; 360 param->yyDay = $5;
361 } else { 361 } else {
362 if ($1 >= 12 || $3 > 31 || $1 == 0 || $3 == 0) 362 if ($1 > 12 || $3 > 31 || $1 == 0 || $3 == 0)
363 YYREJECT; 363 YYREJECT;
364 param->yyMonth = $1; 364 param->yyMonth = $1;
365 param->yyDay = $3; 365 param->yyDay = $3;
366 param->yyYear = $5; 366 param->yyYear = $5;
367 } 367 }
368 } 368 }
369 | tUNUMBER tSNUMBER tSNUMBER { 369 | tUNUMBER tSNUMBER tSNUMBER {
370 /* ISO 8601 format. yyyy-mm-dd. */ 370 /* ISO 8601 format. yyyy-mm-dd. */
371 if ($2 >= 0 || $2 < -12 || $3 >= 0 || $3 < -31) 371 if ($2 >= 0 || $2 < -12 || $3 >= 0 || $3 < -31)
372 YYREJECT; 372 YYREJECT;
373 param->yyYear = $1; 373 param->yyYear = $1;
374 param->yyHaveFullYear = 1; 374 param->yyHaveFullYear = 1;
375 param->yyMonth = -$2; 375 param->yyMonth = -$2;