about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GridText.c48
-rw-r--r--src/LYExtern.c6
-rw-r--r--src/LYMain.c6
-rw-r--r--src/LYMainLoop.c4
-rw-r--r--src/LYStrings.c6
-rw-r--r--src/LYUtils.c8
-rw-r--r--src/Xsystem.c43
-rw-r--r--src/chrtrans/makefile.msc3
-rw-r--r--src/parsdate.c102
9 files changed, 126 insertions, 100 deletions
diff --git a/src/GridText.c b/src/GridText.c
index 885141ce..48e7459b 100644
--- a/src/GridText.c
+++ b/src/GridText.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: GridText.c,v 1.302 2017/07/04 17:27:07 tom Exp $
+ * $LynxId: GridText.c,v 1.306 2018/02/19 23:03:00 tom Exp $
  *
  *		Character grid hypertext object
  *		===============================
@@ -89,6 +89,8 @@ static void HText_trimHightext(HText *text, int final, int stop_before);
 HTkcode last_kcode = NOKANJI;	/* 1997/11/14 (Fri) 09:09:26 */
 #endif
 
+#undef  CHAR_WIDTH
+
 #ifdef CJK_EX
 #define CHAR_WIDTH 6
 #else
@@ -158,10 +160,19 @@ static void *LY_check_calloc(size_t nmemb, size_t size);
 #define ALIGN_SIZE      sizeof(double)
 #endif
 
+#define BITS_DIR	2
+#define BITS_POS	14
+
+#define MASK_DIR	((1U << BITS_DIR) - 1)
+#define CAST_DIR(n)	((MASK_DIR) & (unsigned)(n))
+
+#define MASK_POS	((1U << BITS_POS) - 1)
+#define CAST_POS(n)	((MASK_POS) & (unsigned)(n))
+
 typedef struct {
-    unsigned int sc_direction:2;	/* on or off */
-    unsigned int sc_horizpos:14;	/* horizontal position of this change */
-    unsigned int sc_style:16;	/* which style to change to */
+    unsigned sc_direction:BITS_DIR;	/* on or off */
+    unsigned sc_horizpos:BITS_POS;	/* horizontal position of this change */
+    unsigned sc_style:16;	/* which style to change to */
 } HTStyleChange;
 
 #if defined(USE_COLOR_STYLE)
@@ -2696,7 +2707,7 @@ static HTLine *insert_blanks_in_line(HTLine *line, int line_number,
 	     istyle < line->numstyles && (int) NStyle.sc_horizpos < curlim;
 	     istyle++)
 	    /* Should not we include OFF-styles at curlim? */
-	    NStyle.sc_horizpos += shift;
+	    NStyle.sc_horizpos = CAST_POS(NStyle.sc_horizpos + shift);
 #endif
 	while (copied < pre)	/* Copy verbatim to byte == pre */
 	    *t++ = *copied++;
@@ -2774,14 +2785,14 @@ static HTStyleChange *skip_matched_and_correct_offsets(HTStyleChange *end,
 	    }
 	}
 	if (tmp->sc_horizpos > split_pos) {
-	    tmp->sc_horizpos = split_pos;
+	    tmp->sc_horizpos = CAST_POS(split_pos);
 	}
     }
     return result;
 }
 #endif /* USE_COLOR_STYLE */
 
-#define reset_horizpos(value) value = 0, value = ~value
+#define reset_horizpos(value) value = 0, value ^= MASK_POS
 
 static void split_line(HText *text, unsigned split)
 {
@@ -3031,11 +3042,16 @@ static void split_line(HText *text, unsigned split)
 	while (from >= previous->styles && to >= line->styles) {
 	    *to = *from;
 	    if ((int) to->sc_horizpos > s_post) {
-		to->sc_horizpos += -s_post + SpecialAttrChars;
+		to->sc_horizpos = CAST_POS(to->sc_horizpos
+					   + SpecialAttrChars
+					   - s_post);
 	    } else if ((int) to->sc_horizpos > s_pre &&
 		       (to->sc_direction == STACK_ON ||
 			to->sc_direction == ABS_ON)) {
-		to->sc_horizpos = ((int) to->sc_horizpos < s) ? 0 : SpecialAttrChars;
+		if ((int) to->sc_horizpos < s)
+		    to->sc_horizpos = 0;
+		else
+		    to->sc_horizpos = CAST_POS(SpecialAttrChars);
 	    } else {
 		break;
 	    }
@@ -3078,7 +3094,7 @@ static void split_line(HText *text, unsigned split)
 		    at_end++;
 		    at_end->sc_direction = STACK_OFF;
 		    at_end->sc_style = scan->sc_style;
-		    at_end->sc_horizpos = s_pre;
+		    at_end->sc_horizpos = CAST_POS(s_pre);
 		    CTRACE_STYLE((tfp,
 				  "split_line, %d:style[%d] %d (dir=%d)\n",
 				  s_pre,
@@ -3093,7 +3109,7 @@ static void split_line(HText *text, unsigned split)
 		    to++;
 		else if (to >= line->styles) {
 		    *to = *scan;
-		    to->sc_horizpos = SpecialAttrChars;
+		    to->sc_horizpos = CAST_POS(SpecialAttrChars);
 		    to--;
 		} else {
 		    CTRACE((tfp, "BUG: style overflow after split_line.\n"));
@@ -3101,7 +3117,7 @@ static void split_line(HText *text, unsigned split)
 		}
 	    }
 	    if ((int) scan->sc_horizpos > s_pre) {
-		scan->sc_horizpos = s_pre;
+		scan->sc_horizpos = CAST_POS(s_pre);
 	    }
 	    scan--;
 	}
@@ -4533,7 +4549,7 @@ void _internal_HTC(HText *text, int style, int dir)
 	     */
 	    line->numstyles--;
 	} else if (line->numstyles < MAX_STYLES_ON_LINE) {
-	    line->styles[line->numstyles].sc_horizpos = line->size;
+	    line->styles[line->numstyles].sc_horizpos = CAST_POS(line->size);
 	    /*
 	     * Special chars for bold and underlining usually don't
 	     * occur with color style, but soft hyphen can.
@@ -4541,10 +4557,12 @@ void _internal_HTC(HText *text, int style, int dir)
 	     * counted as ctrl_chars.  - kw
 	     */
 	    if ((int) line->styles[line->numstyles].sc_horizpos >= ctrl_chars_on_this_line) {
-		line->styles[line->numstyles].sc_horizpos -= ctrl_chars_on_this_line;
+		line->styles[line->numstyles].sc_horizpos =
+		    CAST_POS(line->styles[line->numstyles].sc_horizpos
+			     - ctrl_chars_on_this_line);
 	    }
 	    line->styles[line->numstyles].sc_style = (unsigned short) style;
-	    line->styles[line->numstyles].sc_direction = dir;
+	    line->styles[line->numstyles].sc_direction = CAST_DIR(dir);
 	    CTRACE_STYLE((tfp, "internal_HTC %d:style[%d] %d (dir=%d)\n",
 			  line->size,
 			  line->numstyles,
diff --git a/src/LYExtern.c b/src/LYExtern.c
index bed345f3..d36ba0b8 100644
--- a/src/LYExtern.c
+++ b/src/LYExtern.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYExtern.c,v 1.54 2013/11/29 00:21:20 tom Exp $
+ * $LynxId: LYExtern.c,v 1.55 2018/02/15 01:53:07 tom Exp $
  *
  External application support.
  This feature allows lynx to pass a given URL to an external program.
@@ -186,7 +186,7 @@ static char *format_command(char *command,
 	int last_pos;
 
 	LYStrNCpy(host, param + 9, sizeof(host));
-	last_pos = strlen(host) - 1;
+	last_pos = (int) strlen(host) - 1;
 	if (last_pos > 1 && host[last_pos] == '/')
 	    host[last_pos] = '\0';
 
@@ -371,7 +371,7 @@ BOOL run_external(char *param,
 	confirmed = HTConfirm(LYElideString(cmdbuf, 40)) != NO;
 #endif
 	if (confirmed) {
-	    len = strlen(cmdbuf);
+	    len = (int) strlen(cmdbuf);
 	    if (len > 255) {
 		sprintf(buff, "Lynx: command line too long (%d > 255)", len);
 #ifdef WIN_GUI			/* 1997/11/06 (Thu) 14:17:02 */
diff --git a/src/LYMain.c b/src/LYMain.c
index e38ba5bb..38a9a7c9 100644
--- a/src/LYMain.c
+++ b/src/LYMain.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMain.c,v 1.265 2017/07/03 23:31:21 tom Exp $
+ * $LynxId: LYMain.c,v 1.266 2018/02/19 14:29:30 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTP.h>
@@ -1193,8 +1193,8 @@ int main(int argc,
     /*
      * Zero the MultiBookmark arrays.
      */
-    memset((void *) MBM_A_subbookmark, 0, sizeof(char) * (MBM_V_MAXFILES + 1));
-    memset((void *) MBM_A_subdescript, 0, sizeof(char) * (MBM_V_MAXFILES + 1));
+    memset((void *) MBM_A_subbookmark, 0, sizeof(char *) * (MBM_V_MAXFILES + 1));
+    memset((void *) MBM_A_subdescript, 0, sizeof(char *) * (MBM_V_MAXFILES + 1));
 
 #ifndef VMS
     StrAllocCopy(list_format, LIST_FORMAT);
diff --git a/src/LYMainLoop.c b/src/LYMainLoop.c
index 3329985e..dbf51dd4 100644
--- a/src/LYMainLoop.c
+++ b/src/LYMainLoop.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYMainLoop.c,v 1.235 2017/07/02 20:04:20 tom Exp $
+ * $LynxId: LYMainLoop.c,v 1.236 2018/02/15 01:53:44 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTAccess.h>
@@ -725,7 +725,7 @@ static BOOL do_check_recall(int ch,
 
     for (;;) {
 #ifdef WIN_EX			/* 1998/10/11 (Sun) 10:41:05 */
-	int len = strlen((*user_input)->str);
+	int len = (int) strlen((*user_input)->str);
 
 	if (len >= 3) {
 	    if (len < MAX_LINE - 1
diff --git a/src/LYStrings.c b/src/LYStrings.c
index d063a171..f565c4e4 100644
--- a/src/LYStrings.c
+++ b/src/LYStrings.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYStrings.c,v 1.268 2017/05/10 22:11:33 tom Exp $ */
+/* $LynxId: LYStrings.c,v 1.269 2018/02/19 21:22:53 tom Exp $ */
 #include <HTUtils.h>
 #include <HTCJK.h>
 #include <UCAux.h>
@@ -3323,8 +3323,8 @@ int LYDoEdit(FieldEditor * edit, int ch,
 	 */
 	if (!IS_CJK_TTY && LYlowest_eightbit[current_char_set] > 0x97)
 	    return (ch);
-	/* FALLTHRU */
 #endif
+	/* FALLTHRU */
     case LYE_CHAR:
 	uch = UCH(ch);
 	LYEditInsert(edit, &uch, 1, map_active, maxMessage);
@@ -5265,8 +5265,8 @@ int LYgetBString(bstring **inputline,
 		LYLineEdit(edit, ch, FALSE);
 		break;
 	    }
-	    /* FALLTHRU */
 #endif
+	    /* FALLTHRU */
 	case LYE_ENTER:
 	    BStrCopy0(*inputline, Buffer);
 	    if (!hidden)
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 8f7dc7a8..61dc1c5d 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.278 2017/07/02 20:42:32 tom Exp $
+ * $LynxId: LYUtils.c,v 1.279 2018/02/15 01:54:02 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -5303,7 +5303,7 @@ char *LYPathLeaf(char *pathname)
 #else
     int n;
 
-    for (leaf = 0, n = strlen(pathname) - 1; n >= 0; n--) {
+    for (leaf = 0, n = (int) strlen(pathname) - 1; n >= 0; n--) {
 	if (StrChr("\\/:", pathname[n]) != 0) {
 	    leaf = pathname + n + 1;
 	    break;
@@ -7738,7 +7738,7 @@ int put_clip(const char *szBuffer)
     if (szBuffer == NULL)
 	return EOF;
 
-    len = strlen(szBuffer);
+    len = (int) strlen(szBuffer);
     if (len == 0)
 	return EOF;
     else
@@ -8060,7 +8060,7 @@ int unsafe_filename(const char *fname)
 
     sum = 0;
     cp = save;
-    len = strlen(fname);
+    len = (int) strlen(fname);
     while (cp < (save + len)) {
 	if (*cp == '\0') {
 	    cp++;
diff --git a/src/Xsystem.c b/src/Xsystem.c
index ac977c8a..cc6cdd81 100644
--- a/src/Xsystem.c
+++ b/src/Xsystem.c
@@ -1,4 +1,4 @@
-/* $LynxId: Xsystem.c,v 1.28 2013/11/29 00:22:00 tom Exp $
+/* $LynxId: Xsystem.c,v 1.29 2018/02/17 14:58:15 tom Exp $
  *	like system("cmd") but return with exit code of "cmd"
  *	for Turbo-C/MS-C/LSI-C
  *  This code is in the public domain.
@@ -55,12 +55,10 @@ extern char *mktemp(char *);
 #define isdeg(c) ('0' <= (c) && (c) <= '9')
 
 #ifndef NEAR
-#if 0				/* MS-C */
-#define NEAR	_near
-#else
 #define NEAR
 #endif
-#endif
+
+#define SAVE_FD 10
 
 typedef struct _proc {
     struct _proc *next;
@@ -71,8 +69,8 @@ typedef struct _proc {
     int infmod;
     char *outf;
     int outfmod;
-    int ored[10];
-    int sred[10];
+    int ored[SAVE_FD];
+    int sred[SAVE_FD];
 } PRO;
 
 static PRO *p1 = 0;
@@ -112,7 +110,7 @@ static int NEAR is_builtin_command(char *s)
     };
     int i, l, lc, count;
 
-    l = strlen(s);
+    l = (int) strlen(s);
     count = TABLESIZE(cmdtab);
     count--;
 #ifdef WIN_EX
@@ -122,7 +120,7 @@ static int NEAR is_builtin_command(char *s)
     for (i = 0; i < count; i++) {
 	if (strcasecomp(s, cmdtab[i]) == 0)
 	    return 1;
-	lc = strlen(cmdtab[i]);
+	lc = (int) strlen(cmdtab[i]);
 	if (lc < l && strncasecomp(s, cmdtab[i], lc) == 0 && issep2(s[lc]))
 	    return 1;
     }
@@ -145,11 +143,16 @@ static int NEAR getswchar(void)
     return result;
 }
 
+#define spawnl_rc(flag, rc) \
+	((flag == P_WAIT) \
+	 ? (int)(rc) \
+	 : ((rc) == 0 ? -2 : 0))
+
 static int NEAR csystem(PRO * p, int flag)
 {
     char *cmp;
     char SW[3];
-    int rc;
+    intptr_t rc;
 
     if ((cmp = LYGetEnv("COMSPEC")) == 0)
 	return -2;
@@ -157,7 +160,7 @@ static int NEAR csystem(PRO * p, int flag)
     SW[1] = 'c';
     SW[2] = 0;
     rc = spawnl(flag, cmp, cmp, SW, p->cmd, p->arg, (char *) 0);
-    return rc < 0 ? -2 : rc;
+    return spawnl_rc(flag, rc);
 }
 
 static PRO *NEAR pars1c(char *s)
@@ -293,16 +296,19 @@ static int NEAR try3(char *cnm, PRO * p, int flag)
 {
     char cmdb[STR_MAX];
     int rc;
+    intptr_t rc2;
 
     sprintf(cmdb, "%.*s.com", (int) sizeof(cmdb) - 5, cnm);
     if ((rc = open(cmdb, O_RDONLY)) >= 0) {
 	close(rc);
-	return spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+	rc2 = spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+	return spawnl_rc(flag, rc2);
     }
     sprintf(cmdb, "%.*s.exe", (int) sizeof(cmdb) - 5, cnm);
     if ((rc = open(cmdb, O_RDONLY)) >= 0) {
 	close(rc);
-	return spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+	rc2 = spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+	return spawnl_rc(flag, rc2);
     }
     sprintf(cmdb, "%.*s.bat", (int) sizeof(cmdb) - 5, cnm);
     if ((rc = open(cmdb, O_RDONLY)) >= 0) {
@@ -319,8 +325,9 @@ static int NEAR prog_go(PRO * p, int flag)
     char cmdb[STR_MAX];
     char *ep;
     int rc, lc = 0, cmd_len;
+    intptr_t rc2;
 
-    cmd_len = strlen(p->cmd);
+    cmd_len = (int) strlen(p->cmd);
 
     s = p->cmd + cmd_len - 1;
     while (cmd_len && (*s != '\\') && (*s != '/') && (*s != ':')) {
@@ -340,7 +347,8 @@ static int NEAR prog_go(PRO * p, int flag)
 	    if (extp) {		/* has extension */
 		if ((rc = open(cmdb, O_RDONLY)) >= 0) {
 		    close(rc);
-		    rc = spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+		    rc2 = spawnl(flag, cmdb, cmdb, p->arg, (char *) 0);
+		    rc = spawnl_rc(flag, rc2);
 		}
 	    } else {
 		rc = try3(cmdb, p, flag);
@@ -369,7 +377,8 @@ static int NEAR prog_go(PRO * p, int flag)
 	if (extp) {		/* has extension */
 	    if ((rc = open(p->cmd, O_RDONLY)) >= 0) {
 		close(rc);
-		return spawnl(flag, p->cmd, p->cmd, p->arg, (char *) 0);
+		rc2 = spawnl(flag, p->cmd, p->cmd, p->arg, (char *) 0);
+		return spawnl_rc(flag, rc2);
 	    }
 	    return -1;
 	} else {
@@ -386,7 +395,7 @@ static char *NEAR tmpf(char *tp)
 
     if ((ev = LYGetEnv("TMP")) != 0) {
 	LYStrNCpy(tplate, ev, sizeof(tplate) - 2 - strlen(tp));
-	i = strlen(ev);
+	i = (int) strlen(ev);
 	if (i && ev[i - 1] != '\\' && ev[i - 1] != '/')
 	    strcat(tplate, "\\");
     } else {
diff --git a/src/chrtrans/makefile.msc b/src/chrtrans/makefile.msc
index 28b7435d..48d074ab 100644
--- a/src/chrtrans/makefile.msc
+++ b/src/chrtrans/makefile.msc
@@ -9,7 +9,8 @@ INCLUDES = /I "." /I ".." /I "..\.." /I "..\..\WWW\Library\Implementation" /I ".
 DEFS = /D "WIN32_LEAN_AND_MEAN" /D "NDEBUG" /D "__WIN32__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "NO_FILEIO_H" /D "NO_UNISTD_H" /D "_WINDOWS" /D "DOSPATH"
 CFLAGS   = /nologo /MT /W3 /EHsc /O2 /c
 
-LDFLAGS  = /nologo /subsystem:console /incremental:no /machine:I386
+MACHINE  = i386
+LDFLAGS  = /nologo /subsystem:console /incremental:no /machine:$(MACHINE)
 LIBS     = user32.lib wsock32.lib
 
 COMPILE = $(CC) $(CFLAGS) $(INCLUDES) $(DEFS)
diff --git a/src/parsdate.c b/src/parsdate.c
index 26a344bc..15d9cce9 100644
--- a/src/parsdate.c
+++ b/src/parsdate.c
@@ -1,17 +1,18 @@
-#ifndef lint
-static const char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
-#endif
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
 
 #define YYBYACC 1
 #define YYMAJOR 1
 #define YYMINOR 9
-#define YYPATCH 20121003
+#define YYPATCH 20140715
 
 #define YYEMPTY        (-1)
 #define yyclearin      (yychar = YYEMPTY)
 #define yyerrok        (yyerrflag = 0)
 #define YYRECOVERING() (yyerrflag != 0)
-
+#define YYENOMEM       (-2)
+#define YYEOF          0
 #define YYPREFIX "yy"
 
 #define YYPURE 0
@@ -21,7 +22,7 @@ static const char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
 #include <LYLeaks.h>
 
 /*
- *  $LynxId: parsdate.c,v 1.16 2013/01/05 02:00:30 tom Exp $
+ *  $LynxId: parsdate.c,v 1.17 2018/02/19 15:14:58 tom Exp $
  *
  *  This module is adapted and extended from tin, to use for LYmktime().
  *
@@ -161,7 +162,7 @@ typedef union {
     enum _MERIDIAN	Meridian;
 } YYSTYPE;
 #endif /* !YYSTYPE_IS_DECLARED */
-#line 164 "y.tab.c"
+#line 166 "y.tab.c"
 
 /* compatibility with bison */
 #ifdef YYPARSE_PARAM
@@ -205,19 +206,20 @@ extern int YYPARSE_DECL();
 #define tZONE 265
 #define tDST 266
 #define YYERRCODE 256
-static const short yylhs[] = {                           -1,
+typedef short YYINT;
+static const YYINT yylhs[] = {                           -1,
     0,    0,    4,    4,    4,    4,    4,    4,    5,    5,
     5,    5,    5,    2,    2,    2,    2,    2,    1,    6,
     6,    6,    6,    6,    6,    6,    6,    6,    7,    8,
     8,    8,    8,    3,    3,
 };
-static const short yylen[] = {                            2,
+static const YYINT yylen[] = {                            2,
     0,    2,    1,    2,    1,    1,    2,    1,    2,    4,
     4,    6,    6,    1,    1,    2,    2,    1,    1,    3,
     5,    2,    4,    2,    3,    5,    6,    3,    9,    2,
     2,    2,    2,    0,    1,
 };
-static const short yydefred[] = {                         1,
+static const YYINT yydefred[] = {                         1,
     0,    0,    0,    0,    0,    2,    0,    5,    0,    8,
     0,    0,    0,   32,   30,   35,    0,   33,   31,    0,
     0,    0,    9,    0,   19,    0,   18,    4,    7,    0,
@@ -225,10 +227,10 @@ static const short yydefred[] = {                         1,
     0,   23,    0,   11,   10,    0,    0,   26,    0,    0,
    21,    0,   27,   13,   12,    0,    0,   29,
 };
-static const short yydgoto[] = {                          1,
+static const YYINT yydgoto[] = {                          1,
    27,   28,   23,    6,    7,    8,    9,   10,
 };
-static const short yysindex[] = {                         0,
+static const YYINT yysindex[] = {                         0,
  -240,  -41, -256, -227,  -45,    0, -251,    0, -251,    0,
  -254, -249,  -22,    0,    0,    0, -237,    0,    0, -235,
  -228, -226,    0, -236,    0, -224,    0,    0,    0, -223,
@@ -236,7 +238,7 @@ static const short yysindex[] = {                         0,
  -215,    0, -218,    0,    0, -217, -216,    0, -214, -234,
     0,   -8,    0,    0,    0, -213, -212,    0,
 };
-static const short yyrindex[] = {                         0,
+static const YYINT yyrindex[] = {                         0,
     0,    0,    0,    0,    5,    0,   26,    0,   31,    0,
     0,    0,   11,    0,    0,    0,   37,    0,    0,    0,
     0,    0,    0,   16,    0,   32,    0,    0,    0,    0,
@@ -244,11 +246,11 @@ static const short yyrindex[] = {                         0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    1,
     0,    0,    0,    0,    0,    0,    0,    0,
 };
-static const short yygindex[] = {                         0,
+static const YYINT yygindex[] = {                         0,
   -17,   44,  -31,    0,    0,    0,    0,    0,
 };
 #define YYTABLESIZE 300
-static const short yytable[] = {                         43,
+static const YYINT yytable[] = {                         43,
    34,   22,   12,   45,   34,   41,   24,   13,   38,   30,
    22,   25,   21,   26,   31,   15,    2,   44,   55,    3,
    20,   32,    4,    5,   16,    3,   33,   34,   25,   37,
@@ -280,7 +282,7 @@ static const short yytable[] = {                         43,
    20,    0,    3,   20,   20,    3,    0,    6,   14,    3,
     6,   14,    0,   24,    6,   14,   24,    0,    0,   24,
 };
-static const short yycheck[] = {                         58,
+static const YYINT yycheck[] = {                         58,
     0,   47,   44,   35,    0,   45,  258,  264,   26,  264,
     0,  263,   58,  265,  264,    0,  257,   35,   50,  260,
     0,   44,  263,  264,  259,    0,  264,  263,  263,  266,
@@ -317,8 +319,10 @@ static const short yycheck[] = {                         58,
 #define YYDEBUG 0
 #endif
 #define YYMAXTOKEN 266
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
 #if YYDEBUG
-static const char *yyname[] = {
+static const char *const yyname[] = {
 
 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,"','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,"':'",0,0,0,0,0,0,0,
@@ -328,9 +332,9 @@ static const char *yyname[] = {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"tDAY","tDAYZONE",
 "tMERIDIAN","tMONTH","tMONTH_UNIT","tSEC_UNIT","tSNUMBER","tUNUMBER","tZONE",
-"tDST",
+"tDST",0,0,0,0,0,0,0,0,0,0,"illegal-symbol",
 };
-static const char *yyrule[] = {
+static const char *const yyrule[] = {
 "$accept : spec",
 "spec :",
 "spec : spec item",
@@ -387,18 +391,18 @@ YYSTYPE  yylval;
 #ifdef YYMAXDEPTH
 #define YYSTACKSIZE YYMAXDEPTH
 #else
-#define YYSTACKSIZE 500
-#define YYMAXDEPTH  500
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH  10000
 #endif
 #endif
 
-#define YYINITSTACKSIZE 500
+#define YYINITSTACKSIZE 200
 
 typedef struct {
     unsigned stacksize;
-    short    *s_base;
-    short    *s_mark;
-    short    *s_last;
+    YYINT    *s_base;
+    YYINT    *s_mark;
+    YYINT    *s_last;
     YYSTYPE  *l_base;
     YYSTYPE  *l_mark;
 } YYSTACKDATA;
@@ -986,7 +990,7 @@ time_t parsedate(char *p,
      * from the error return value.  (Alternately could set errno on error.) */
     return (Start == (time_t) -1) ? 0 : Start;
 }
-#line 989 "y.tab.c"
+#line 994 "y.tab.c"
 
 #if YYDEBUG
 #include <stdio.h>		/* needed for printf */
@@ -1000,27 +1004,27 @@ static int yygrowstack(YYSTACKDATA *data)
 {
     int i;
     unsigned newsize;
-    short *newss;
+    YYINT *newss;
     YYSTYPE *newvs;
 
     if ((newsize = data->stacksize) == 0)
         newsize = YYINITSTACKSIZE;
     else if (newsize >= YYMAXDEPTH)
-        return -1;
+        return YYENOMEM;
     else if ((newsize *= 2) > YYMAXDEPTH)
         newsize = YYMAXDEPTH;
 
     i = (int) (data->s_mark - data->s_base);
-    newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+    newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
     if (newss == 0)
-        return -1;
+        return YYENOMEM;
 
     data->s_base = newss;
     data->s_mark = newss + i;
 
     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
     if (newvs == 0)
-        return -1;
+        return YYENOMEM;
 
     data->l_base = newvs;
     data->l_mark = newvs + i;
@@ -1070,7 +1074,7 @@ YYPARSE_DECL()
     memset(&yystack, 0, sizeof(yystack));
 #endif
 
-    if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
+    if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
     yystack.s_mark = yystack.s_base;
     yystack.l_mark = yystack.l_base;
     yystate = 0;
@@ -1080,13 +1084,11 @@ yyloop:
     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
     if (yychar < 0)
     {
-        if ((yychar = YYLEX) < 0) yychar = 0;
+        if ((yychar = YYLEX) < 0) yychar = YYEOF;
 #if YYDEBUG
         if (yydebug)
         {
-            yys = 0;
-            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
-            if (!yys) yys = "illegal-symbol";
+            yys = yyname[YYTRANSLATE(yychar)];
             printf("%sdebug: state %d, reading %d (%s)\n",
                     YYPREFIX, yystate, yychar, yys);
         }
@@ -1100,7 +1102,7 @@ yyloop:
             printf("%sdebug: state %d, shifting to state %d\n",
                     YYPREFIX, yystate, yytable[yyn]);
 #endif
-        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
+        if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
         {
             goto yyoverflow;
         }
@@ -1119,7 +1121,7 @@ yyloop:
     }
     if (yyerrflag) goto yyinrecovery;
 
-    yyerror("syntax error");
+    YYERROR_CALL("syntax error");
 
     goto yyerrlab;
 
@@ -1140,7 +1142,7 @@ yyinrecovery:
                     printf("%sdebug: state %d, error recovery shifting\
  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
 #endif
-                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
+                if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
                 {
                     goto yyoverflow;
                 }
@@ -1164,13 +1166,11 @@ yyinrecovery:
     }
     else
     {
-        if (yychar == 0) goto yyabort;
+        if (yychar == YYEOF) goto yyabort;
 #if YYDEBUG
         if (yydebug)
         {
-            yys = 0;
-            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
-            if (!yys) yys = "illegal-symbol";
+            yys = yyname[YYTRANSLATE(yychar)];
             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
                     YYPREFIX, yystate, yychar, yys);
         }
@@ -1478,7 +1478,7 @@ case 35:
 	    yyval.Meridian = yystack.l_mark[0].Meridian;
 	}
 break;
-#line 1481 "y.tab.c"
+#line 1482 "y.tab.c"
     }
     yystack.s_mark -= yym;
     yystate = *yystack.s_mark;
@@ -1496,19 +1496,17 @@ break;
         *++yystack.l_mark = yyval;
         if (yychar < 0)
         {
-            if ((yychar = YYLEX) < 0) yychar = 0;
+            if ((yychar = YYLEX) < 0) yychar = YYEOF;
 #if YYDEBUG
             if (yydebug)
             {
-                yys = 0;
-                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
-                if (!yys) yys = "illegal-symbol";
+                yys = yyname[YYTRANSLATE(yychar)];
                 printf("%sdebug: state %d, reading %d (%s)\n",
                         YYPREFIX, YYFINAL, yychar, yys);
             }
 #endif
         }
-        if (yychar == 0) goto yyaccept;
+        if (yychar == YYEOF) goto yyaccept;
         goto yyloop;
     }
     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
@@ -1521,16 +1519,16 @@ break;
         printf("%sdebug: after reduction, shifting from state %d \
 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
 #endif
-    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
+    if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
     {
         goto yyoverflow;
     }
-    *++yystack.s_mark = (short) yystate;
+    *++yystack.s_mark = (YYINT) yystate;
     *++yystack.l_mark = yyval;
     goto yyloop;
 
 yyoverflow:
-    yyerror("yacc stack overflow");
+    YYERROR_CALL("yacc stack overflow");
 
 yyabort:
     yyfreestack(&yystack);