Fix some problems.

o  Y2K problem.
  o  repl coredump problem.

Submitted by:	mh-plus project (japanese/mh developper)
This commit is contained in:
Motoyuki Konno 2000-03-11 00:47:03 +00:00
parent 31f4804910
commit 3a7c9e3d91
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=26730
4 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,38 @@
--- zotnet/tws/dtime.c.orig Tue Feb 9 20:30:00 1999
+++ zotnet/tws/dtime.c Tue Jan 4 20:46:46 2000
@@ -170,7 +170,7 @@
tw.tw_hour = tm -> tm_hour;
tw.tw_mday = tm -> tm_mday;
tw.tw_mon = tm -> tm_mon;
- tw.tw_year = tm -> tm_year + CENTURY;
+ tw.tw_year = tm -> tm_year + 1900;
tw.tw_wday = tm -> tm_wday;
tw.tw_yday = tm -> tm_yday;
if (tm -> tm_isdst)
@@ -212,7 +212,7 @@
tw.tw_hour = tm -> tm_hour;
tw.tw_mday = tm -> tm_mday;
tw.tw_mon = tm -> tm_mon;
- tw.tw_year = tm -> tm_year + CENTURY;
+ tw.tw_year = tm -> tm_year + 1900;
tw.tw_wday = tm -> tm_wday;
tw.tw_yday = tm -> tm_yday;
if (tm -> tm_isdst)
@@ -370,12 +370,14 @@
|| (min = tw -> tw_min) < 0 || min > 59
|| (hour = tw -> tw_hour) < 0 || hour > 23
|| (mday = tw -> tw_mday) < 1 || mday > 31
- || (mon = tw -> tw_mon + 1) < 1 || mon > 12)
+ || (mon = tw -> tw_mon + 1) < 1 || mon > 12
+ || (year = tw -> tw_year) < 0)
return (tw -> tw_clock = -1L);
- year = tw -> tw_year;
result = 0L;
- if (year < 100)
+ if (year < 69)
+ year += CENTURY + 100;
+ else if (year < 100)
year += CENTURY;
for (i = 1970; i < year; i++)
result += dysize (i);

View file

@ -0,0 +1,33 @@
--- zotnet/tws/dtimep.c-lexed.orig Tue Feb 9 20:30:00 1999
+++ zotnet/tws/dtimep.c-lexed Tue Jan 4 11:03:29 2000
@@ -151,6 +151,7 @@
/* Zero out the struct. */
bzero( (char *) &tw, sizeof tw);
+ tw.tw_year = -1;
/* Set default time zone. */
#ifdef ZONEINFO
@@ -175,17 +176,19 @@
switch (cp = str, *cp ? lex_string( &str, start_cond) : 0) {
case -1:
- if (!gotdate || tw.tw_year == 0)
+ if (!gotdate || tw.tw_year == -1)
return (struct tws *)0;
/* fall through */
case 0:
- if ( tw.tw_year == 0 ) {
+ if ( tw.tw_year == -1 ) {
/* Set default year. */
time (&tclock);
tw.tw_year = localtime(&tclock)->tm_year + 1900;
}
+ else if (tw.tw_year < 69) {
+ tw.tw_year += 2000;
+ }
else if (tw.tw_year < 100) {
- /* assume no 2-digit years > 1999 */
tw.tw_year += 1900;
}
return &tw;

View file

@ -0,0 +1,34 @@
--- zotnet/tws/dtimep.lex.orig Tue Feb 9 20:30:00 1999
+++ zotnet/tws/dtimep.lex Tue Jan 4 11:32:43 2000
@@ -181,6 +181,7 @@
/* Zero out the struct. */
bzero( (char *) &tw, sizeof tw);
+ tw.tw_year = -1;
/* Set default time zone. */
#ifdef ZONEINFO
@@ -205,17 +206,19 @@
switch (cp = str, *cp ? lex_string( &str, start_cond) : 0) {
case -1:
- if (!gotdate || tw.tw_year == 0)
+ if (!gotdate || tw.tw_year == -1)
return (struct tws *)0;
/* fall through */
case 0:
- if ( tw.tw_year == 0 ) {
+ if ( tw.tw_year == -1 ) {
/* Set default year. */
time (&tclock);
tw.tw_year = localtime(&tclock)->tm_year + 1900;
}
+ else if (tw.tw_year < 69) {
+ tw.tw_year += 2000;
+ }
else if (tw.tw_year < 100) {
- /* assume no 2-digit years > 1999 */
tw.tw_year += 1900;
}
return &tw;

View file

@ -0,0 +1,18 @@
--- uip/replsbr.c.orig Fri Sep 10 13:51:41 1999
+++ uip/replsbr.c Wed Jan 12 12:04:01 2000
@@ -215,11 +215,9 @@
finished:
/* drop ending newline */
for (i = 0; i < sizeof(wantcomp)/sizeof(wantcomp[0]); i++)
- if ((cptr = wantcomp[i]) && cptr->c_text)
- do {
- if ((cp = rindex(cptr->c_text, '\n')) && !cp[1])
- *cp = 0;
- } while (cptr = cptr->c_next);
+ for (cptr = wantcomp[i]; cptr; cptr = cptr->c_next)
+ if (cptr->c_text && (cp = rindex(cptr->c_text, '\n')) && !cp[1])
+ *cp = 0;
/* if there's a "subject" component, strip any "re:"s off it */
FINDCOMP (cptr, "subject")