*** date.c	Tue Feb 17 09:04:06 1998
--- date.c.ORIG	Sun Jun 23 20:16:30 1996
***************
*** 67,73 ****
  int retval, nflag;
  
  static void setthetime __P((char *));
! static void badformat __P((int));
  static void usage __P((void));
  
  int logwtmp __P((char *, char *, char *));
--- 67,73 ----
  int retval, nflag;
  
  static void setthetime __P((char *));
! static void badformat __P((void));
  static void usage __P((void));
  
  int logwtmp __P((char *, char *, char *));
***************
*** 167,174 ****
  	register struct tm *lt;
  	struct timeval tv;
  	char *dot, *t;
- 	int tmpNumYearDigit = 0;
- 	int tmpCentury = 0;
  
  	for (t = p, dot = NULL; *t; ++t) {
  		if (isdigit(*t))
--- 167,172 ----
***************
*** 177,183 ****
  			dot = t;
  			continue;
  		}
! 		badformat(1);
  	}
  
  	lt = localtime(&tval);
--- 175,181 ----
  			dot = t;
  			continue;
  		}
! 		badformat();
  	}
  
  	lt = localtime(&tval);
***************
*** 185,251 ****
  	if (dot != NULL) {			/* .ss */
  		*dot++ = '\0';
  		if (strlen(dot) != 2)
! 			badformat(2);
  		lt->tm_sec = ATOI2(dot);
  		if (lt->tm_sec > 61)
! 			badformat(3);
  	} else
  		lt->tm_sec = 0;
  
  	switch (strlen(p)) {
- 	case 12:				/* cc */
- 		tmpNumYearDigit = 4;
- 		tmpCentury = ATOI2(p);
- 	case 11:				/* yyy */
- 		/* 3 digit year: skip the first character and do */
- 		/* nothing, the next case will automagically add */
- 		/* 100 years if the next 2 digits are < 69 */
- 		/* This will keep things right until the year 2069 */
- 		if (tmpNumYearDigit != 4)
- 		{
- 			p += 1;
- 		}
- 		/* FALLTHROUGH */
  	case 10:				/* yy */
  		lt->tm_year = ATOI2(p);
- 		if (tmpNumYearDigit==4)
- 		{
- 			lt->tm_year += (tmpCentury - 19) * 100 ;
- 		}
- 		else
- 		{
  		if (lt->tm_year < 69)		/* hack for 2000 ;-} */
  			lt->tm_year += 100;
- 		}
  		/* FALLTHROUGH */
  	case 8:					/* mm */
  		lt->tm_mon = ATOI2(p);
  		if (lt->tm_mon > 12)
! 			badformat(4);
  		--lt->tm_mon;			/* time struct is 0 - 11 */
  		/* FALLTHROUGH */
  	case 6:					/* dd */
  		lt->tm_mday = ATOI2(p);
  		if (lt->tm_mday > 31)
! 			badformat(5);
  		/* FALLTHROUGH */
  	case 4:					/* hh */
  		lt->tm_hour = ATOI2(p);
  		if (lt->tm_hour > 23)
! 			badformat(6);
  		/* FALLTHROUGH */
  	case 2:					/* mm */
  		lt->tm_min = ATOI2(p);
  		if (lt->tm_min > 59)
! 			badformat(7);
  		break;
  	default:
! 		badformat(8);
  	}
  
  	/* convert broken-down time to GMT clock time */
  	if ((tval = mktime(lt)) == -1)
! 		badformat(9);
  
  	/* set the time */
  	if (nflag || netsettime(tval)) {
--- 183,229 ----
  	if (dot != NULL) {			/* .ss */
  		*dot++ = '\0';
  		if (strlen(dot) != 2)
! 			badformat();
  		lt->tm_sec = ATOI2(dot);
  		if (lt->tm_sec > 61)
! 			badformat();
  	} else
  		lt->tm_sec = 0;
  
  	switch (strlen(p)) {
  	case 10:				/* yy */
  		lt->tm_year = ATOI2(p);
  		if (lt->tm_year < 69)		/* hack for 2000 ;-} */
  			lt->tm_year += 100;
  		/* FALLTHROUGH */
  	case 8:					/* mm */
  		lt->tm_mon = ATOI2(p);
  		if (lt->tm_mon > 12)
! 			badformat();
  		--lt->tm_mon;			/* time struct is 0 - 11 */
  		/* FALLTHROUGH */
  	case 6:					/* dd */
  		lt->tm_mday = ATOI2(p);
  		if (lt->tm_mday > 31)
! 			badformat();
  		/* FALLTHROUGH */
  	case 4:					/* hh */
  		lt->tm_hour = ATOI2(p);
  		if (lt->tm_hour > 23)
! 			badformat();
  		/* FALLTHROUGH */
  	case 2:					/* mm */
  		lt->tm_min = ATOI2(p);
  		if (lt->tm_min > 59)
! 			badformat();
  		break;
  	default:
! 		badformat();
  	}
  
  	/* convert broken-down time to GMT clock time */
  	if ((tval = mktime(lt)) == -1)
! 		badformat();
  
  	/* set the time */
  	if (nflag || netsettime(tval)) {
***************
*** 265,273 ****
  }
  
  static void
! badformat(pNum)
  {
! 	warnx("illegal time format %d", pNum);
  	usage();
  }
  
--- 243,251 ----
  }
  
  static void
! badformat()
  {
! 	warnx("illegal time format");
  	usage();
  }
  
***************
*** 276,281 ****
  {
  	(void)fprintf(stderr,
  	    "usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format]\n");
! 	(void)fprintf(stderr, "         [cc[yy[mm[dd[hh]]]]]mm[.ss]]\n");
  	exit(1);
  }
--- 254,259 ----
  {
  	(void)fprintf(stderr,
  	    "usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format]\n");
! 	(void)fprintf(stderr, "            [yy[mm[dd[hh]]]]mm[.ss]]\n");
  	exit(1);
  }
