** Originally written by Steven M. Bellovin <smb@research.att.com> while
** at the University of North Carolina at Chapel Hill. Later tweaked by
** a couple of people on Usenet. Completely overhauled by Rich $alz
-** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
-**
-** This grammar has 13 shift/reduce conflicts.
+** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
**
** This code is in the public domain and has no copyright.
*/
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
-#include "getdate.h"
-
#if defined (STDC_HEADERS) || defined (USG)
# include <string.h>
#endif
# define bcopy(from, to, len) memcpy ((to), (from), (len))
#endif
-extern struct tm *gmtime ();
-extern struct tm *localtime ();
-extern time_t mktime ();
-
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
yacc generated parsers in the same program. Note that these are only
%}
+/* This grammar has 13 shift/reduce conflicts. */
+%expect 13
+
%union {
int Number;
enum _MERIDIAN Meridian;
yyRelYear += $1 * $2;
}
| tYEAR_UNIT {
- yyRelYear++;
+ yyRelYear += $1;
}
| tUNUMBER tMONTH_UNIT {
yyRelMonth += $1 * $2;
yyRelMonth += $1 * $2;
}
| tMONTH_UNIT {
- yyRelMonth++;
+ yyRelMonth += $1;
}
| tUNUMBER tDAY_UNIT {
yyRelDay += $1 * $2;
yyRelDay += $1 * $2;
}
| tDAY_UNIT {
- yyRelDay++;
+ yyRelDay += $1;
}
| tUNUMBER tHOUR_UNIT {
yyRelHour += $1 * $2;
yyRelHour += $1 * $2;
}
| tHOUR_UNIT {
- yyRelHour++;
+ yyRelHour += $1;
}
| tUNUMBER tMINUTE_UNIT {
yyRelMinutes += $1 * $2;
yyRelMinutes += $1 * $2;
}
| tMINUTE_UNIT {
- yyRelMinutes++;
+ yyRelMinutes += $1;
}
| tUNUMBER tSEC_UNIT {
yyRelSeconds += $1 * $2;
yyRelSeconds += $1 * $2;
}
| tSEC_UNIT {
- yyRelSeconds++;
+ yyRelSeconds += $1;
}
;
%%
+/* Include this file down here because bison inserts code above which
+ may define-away `const'. We want the prototype for get_date to have
+ the same signature as the function definition does. */
+#include "getdate.h"
+
+extern struct tm *gmtime ();
+extern struct tm *localtime ();
+extern time_t mktime ();
+
/* Month and day table. */
static TABLE const MonthDayTable[] = {
{ "january", tMONTH, 1 },
{ "now", tMINUTE_UNIT, 0 },
{ "last", tUNUMBER, -1 },
{ "this", tMINUTE_UNIT, 0 },
- { "next", tUNUMBER, 2 },
+ { "next", tUNUMBER, 1 },
{ "first", tUNUMBER, 1 },
/* { "second", tUNUMBER, 2 }, */
{ "third", tUNUMBER, 3 },
}
time_t
-get_date (p, now)
- const char *p;
- const time_t *now;
+get_date (const char *p, const time_t *now)
{
struct tm tm, tm0, *tmp;
time_t Start;