* [sgi]: Undefine timezone before including <time.h>.
[gnulib.git] / lib / getdate.y
index bff1a9b..4d2af5c 100644 (file)
@@ -1,5 +1,5 @@
 %{
-/* $Revision: 2.1 $
+/* $Revision: 1.2 $
 **
 **  Originally written by Steven M. Bellovin <smb@research.att.com> while
 **  at the University of North Carolina at Chapel Hill.  Later tweaked by
@@ -7,17 +7,21 @@
 **  <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
 **  send any email to Rich.
 **
-**  This grammar has eight shift/reduce conflicts.
+**  This grammar has nine shift/reduce conflicts.
 **
 **  This code is in the public domain and has no copyright.
 */
 /* SUPPRESS 287 on yaccpar_sccsid *//* Unusd static variable */
 /* SUPPRESS 288 on yyerrlab *//* Label unused */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #ifdef __GNUC__
 #define alloca __builtin_alloca
 #else
-#ifdef sparc
+#ifdef HAVE_ALLOCA_H
 #include <alloca.h>
 #else
 #ifdef _AIX /* for Bison */
@@ -36,10 +40,6 @@ char *alloca ();
    tricks are need, but defaults to using the gettimeofday system call.
    Include <sys/time.h> if that will be used.  */
 
-#if !defined (USG) && !defined (sgi) && !defined (__386BSD__)
-#include <sys/time.h>
-#endif
-
 #if    defined(vms)
 
 #include <types.h>
@@ -49,6 +49,16 @@ char *alloca ();
 
 #include <sys/types.h>
 
+#if sgi
+#undef timezone
+#endif
+
+#if !(defined (USG) || defined (sgi) || defined (__386BSD__)) || defined(BSD4_2) || defined(BSD4_1C) || (defined (hp9000) && !defined (hpux)) || defined(_AIX) 
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+
 #if    defined(USG) || !defined(HAVE_FTIME)
 /*
 **  If you need to do a tzset() call to set the
@@ -67,34 +77,24 @@ struct timeb {
 
 #endif /* defined(USG) && !defined(HAVE_FTIME) */
 
-#if    defined(BSD4_2) || defined(BSD4_1C) || (defined (hp9000) && !defined (hpux))
-#include <sys/time.h>
-#else
-#if defined(_AIX)
-#include <sys/time.h>
-#endif
-#include <time.h>
-#endif /* defined(BSD4_2) */
-
 #endif /* defined(vms) */
 
 #if defined (STDC_HEADERS) || defined (USG)
 #include <string.h>
 #endif
 
-#if sgi
-#undef timezone
-#endif
-
 extern struct tm       *localtime();
 
 #define yyparse getdate_yyparse
 #define yylex getdate_yylex
 #define yyerror getdate_yyerror
 
+static int yylex ();
+static int yyerror ();
+
 #if    !defined(lint) && !defined(SABER)
 static char RCS[] =
-       "$Header: str2date.y,v 2.1 90/09/06 08:15:06 cronan Exp $";
+       "$Header: /w/src/cvsroot/fileutils/lib/getdate.y,v 1.2 1993/04/04 15:21:49 meyering Exp $";
 #endif /* !defined(lint) && !defined(SABER) */
 
 
@@ -366,7 +366,7 @@ o_merid     : /* NULL */ {
 %%
 
 /* Month and day table. */
-static TABLE   MonthDayTable[] = {
+static TABLE const MonthDayTable[] = {
     { "january",       tMONTH,  1 },
     { "february",      tMONTH,  2 },
     { "march",         tMONTH,  3 },
@@ -395,7 +395,7 @@ static TABLE        MonthDayTable[] = {
 };
 
 /* Time units table. */
-static TABLE   UnitsTable[] = {
+static TABLE const UnitsTable[] = {
     { "year",          tMONTH_UNIT,    12 },
     { "month",         tMONTH_UNIT,    1 },
     { "fortnight",     tMINUTE_UNIT,   14 * 24 * 60 },
@@ -410,7 +410,7 @@ static TABLE        UnitsTable[] = {
 };
 
 /* Assorted relative-time words. */
-static TABLE   OtherTable[] = {
+static TABLE const OtherTable[] = {
     { "tomorrow",      tMINUTE_UNIT,   1 * 24 * 60 },
     { "yesterday",     tMINUTE_UNIT,   -1 * 24 * 60 },
     { "today",         tMINUTE_UNIT,   0 },
@@ -436,7 +436,7 @@ static TABLE        OtherTable[] = {
 
 /* The timezone table. */
 /* Some of these are commented out because a time_t can't store a float. */
-static TABLE   TimezoneTable[] = {
+static TABLE const TimezoneTable[] = {
     { "gmt",   tZONE,     HOUR( 0) },  /* Greenwich Mean */
     { "ut",    tZONE,     HOUR( 0) },  /* Universal (Coordinated) */
     { "utc",   tZONE,     HOUR( 0) },
@@ -520,7 +520,7 @@ static TABLE        TimezoneTable[] = {
 };
 
 /* Military timezone table. */
-static TABLE   MilitaryTable[] = {
+static TABLE const MilitaryTable[] = {
     { "a",     tZONE,  HOUR(  1) },
     { "b",     tZONE,  HOUR(  2) },
     { "c",     tZONE,  HOUR(  3) },
@@ -553,7 +553,7 @@ static TABLE        MilitaryTable[] = {
 
 
 /* ARGSUSED */
-int
+static int
 yyerror(s)
     char       *s;
 {
@@ -599,7 +599,7 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
     MERIDIAN   Meridian;
     DSTMODE    DSTmode;
 {
-    static int DaysInMonth[12] = {
+    static int DaysInMonth[12] = {
        31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
     };
     time_t     tod;
@@ -693,7 +693,7 @@ LookupWord(buff)
 {
     register char      *p;
     register char      *q;
-    register TABLE     *tp;
+    register const TABLE       *tp;
     int                        i;
     int                        abbrev;
 
@@ -794,7 +794,7 @@ LookupWord(buff)
 }
 
 
-int
+static int
 yylex()
 {
     register char      c;