? y.tab.c
? x
Index: getdate.y
===================================================================
RCS file: /cvsroot/lde/lde/src/swiped/cnews/getdate.y,v
retrieving revision 1.3
diff -c -r1.3 getdate.y
*** getdate.y	2002/01/10 18:06:48	1.3
--- getdate.y	2002/01/13 07:28:50
***************
*** 5,16 ****
  	/*	University of North Carolina at Chapel Hill	*/
  	/*	@(#)getdate.y	2.13	9/16/86 */
  
  #include <stdio.h>
  #include <sys/types.h>
  #include <ctype.h>
  #include <time.h>
  #define	timezone	tmzn	/* ugly hack for obscure name clash */
! #include <sys/timeb.h>
  
  #define daysec (24L*60L*60L)
  
--- 5,24 ----
  	/*	University of North Carolina at Chapel Hill	*/
  	/*	@(#)getdate.y	2.13	9/16/86 */
  
+ #if HAVE_STRUCT_TIMEB /* If don't have this, forget it */
+ 
+ 
  #include <stdio.h>
+ #include <stdlib.h>
  #include <sys/types.h>
  #include <ctype.h>
  #include <time.h>
+ #if TM_IN_SYS_TIME
+ #include <sys/time.h>
+ #endif
+ #include "../../swiped.h"
  #define	timezone	tmzn	/* ugly hack for obscure name clash */
! 
  
  #define daysec (24L*60L*60L)
  
***************
*** 26,31 ****
--- 34,49 ----
  #define DAYLIGHT 1
  #define STANDARD 2
  #define MAYBE    3
+ 
+ void yyerror(char *s);
+ static time_t dateconv(int mm, int dd, int yy, int h, int m, 
+          int s, int mer, int zone, int dayflag);
+ static time_t dayconv(int ord, int day, time_t now);
+ static time_t timeconv(int hh, int mm, int ss, int mer);
+ static time_t monthadd(time_t sdate, time_t relmonth);
+ static time_t daylcorr(time_t future, time_t now);
+ static int lookup(char *id);
+ 
  %}
  
  %%
***************
*** 111,125 ****
  	{31, 0, 31,  30, 31, 30,  31, 31, 30,  31, 30, 31};
  #define epoch 1970
  
- extern struct tm *localtime();
- 
  static time_t
! dateconv(mm, dd, yy, h, m, s, mer, zone, dayflag)
! int mm, dd, yy, h, m, s, mer, zone, dayflag;
  {
  	time_t tod, jdate;
  	register int i;
- 	time_t timeconv();
  
  	if (yy < 0) yy = -yy;
  	if (yy < 70) yy += 2000; else if (yy < 100) yy += 1900;
--- 129,140 ----
  	{31, 0, 31,  30, 31, 30,  31, 31, 30,  31, 30, 31};
  #define epoch 1970
  
  static time_t
! dateconv(int mm, int dd, int yy, int h, int m, 
!          int s, int mer, int zone, int dayflag)
  {
  	time_t tod, jdate;
  	register int i;
  
  	if (yy < 0) yy = -yy;
  	if (yy < 70) yy += 2000; else if (yy < 100) yy += 1900;
***************
*** 139,150 ****
  }
  
  static time_t
! dayconv(ord, day, now)
! int ord, day; time_t now;
  {
  	register struct tm *loctime;
  	time_t tod;
- 	time_t daylcorr();
  
  	tod = now;
  	loctime = localtime(&tod);
--- 154,163 ----
  }
  
  static time_t
! dayconv(int ord, int day, time_t now)
  {
  	register struct tm *loctime;
  	time_t tod;
  
  	tod = now;
  	loctime = localtime(&tod);
***************
*** 154,161 ****
  }
  
  static time_t
! timeconv(hh, mm, ss, mer)
! register int hh, mm, ss, mer;
  {
  	if (mm < 0 || mm > 59 || ss < 0 || ss > 59) return (-1);
  	switch (mer) {
--- 167,173 ----
  }
  
  static time_t
! timeconv(int hh, int mm, int ss, int mer)
  {
  	if (mm < 0 || mm > 59 || ss < 0 || ss > 59) return (-1);
  	switch (mer) {
***************
*** 170,181 ****
  }
  
  static time_t
! monthadd(sdate, relmonth)
! time_t sdate, relmonth;
  {
  	struct tm *ltime;
- 	time_t dateconv();
- 	time_t daylcorr();
  	int mm, yy;
  
  	if (relmonth == 0) return 0;
--- 182,190 ----
  }
  
  static time_t
! monthadd(time_t sdate, time_t relmonth)
  {
  	struct tm *ltime;
  	int mm, yy;
  
  	if (relmonth == 0) return 0;
***************
*** 188,195 ****
  }
  
  static time_t
! daylcorr(future, now)
! time_t future, now;
  {
  	int fdayl, nowdayl;
  
--- 197,203 ----
  }
  
  static time_t
! daylcorr(time_t future, time_t now)
  {
  	int fdayl, nowdayl;
  
***************
*** 422,432 ****
  	{0, 0, 0}};
  
  static
! lookup(id)
! char *id;
  {
  #define gotit (yylval=i->value,  i->type)
! #define getid for(j=idvar, k=id; *j++ = *k++; )
  
  	char idvar[20];
  	register char *j, *k;
--- 430,439 ----
  	{0, 0, 0}};
  
  static
! int lookup(char *id)
  {
  #define gotit (yylval=i->value,  i->type)
! #define getid for(j=idvar, k=id; (*j++ = *k++); )
  
  	char idvar[20];
  	register char *j, *k;
***************
*** 484,495 ****
  }
  
  time_t
! lde_getdate(p, now)
! char *p;
! struct timeb *now;
  {
  #define mcheck(f)	if (f>1) err++
- 	time_t monthadd();
  	int err;
  	struct tm *lt;
  	struct timeb ftz;
--- 491,499 ----
  }
  
  time_t
! lde_getdate(char *p, struct timeb *now)
  {
  #define mcheck(f)	if (f>1) err++
  	int err;
  	struct tm *lt;
  	struct timeb ftz;
***************
*** 512,518 ****
  	hh = mm = ss = 0;
  	merid = 24;
  
! 	if (err = yyparse()) return (-1);
  
  	mcheck(timeflag);
  	mcheck(zoneflag);
--- 516,522 ----
  	hh = mm = ss = 0;
  	merid = 24;
  
! 	if ((err = yyparse())) return (-1);
  
  	mcheck(timeflag);
  	mcheck(zoneflag);
***************
*** 541,546 ****
  
  	return sdate;
  }
  
! yyerror(s) char *s;
! {}
--- 545,555 ----
  
  	return sdate;
  }
+ 
+ #else
+ 
+ #warning No struct timeb defined, you will not be able to edit inode times. ******************************************************************************
+ 
+ #endif /* HAVE_STRUCT_TIMEB */
  
! void yyerror(char *s) {}
