Index: /trunk/src/kash/arith.y
===================================================================
--- /trunk/src/kash/arith.y	(revision 2414)
+++ /trunk/src/kash/arith.y	(revision 2415)
@@ -57,4 +57,11 @@
 int main(int , char *[]);
 int error(char *);
+#else
+# undef  malloc
+# define malloc(cb)        sh_malloc(NULL, (cb))
+# undef  realloc
+# define realloc(pv,cb)    sh_realloc(NULL, (pv), (cb))
+# undef  free
+# define free(pv)          sh_free(NULL, (pv))
 #endif
 
Index: /trunk/src/kash/arith_lex.l
===================================================================
--- /trunk/src/kash/arith_lex.l	(revision 2414)
+++ /trunk/src/kash/arith_lex.l	(revision 2415)
@@ -1,3 +1,33 @@
+%option never-interactive
 %option noyywrap
+%option noinput
+%option nounput
+%option noyyget_out
+%option noyy_push_state
+%option noyy_pop_state
+%option noyy_top_state
+%option noyy_scan_buffer
+%option noyy_scan_bytes
+%option noyy_scan_string
+%option noyyget_extra
+%option noyyset_extra
+%option noyyget_leng
+%option noyyget_text
+%option noyyget_lineno
+%option noyyset_lineno
+%option noyyget_in
+%option noyyset_in
+%option noyyget_out
+%option noyyset_out
+%option noyyget_lval
+%option noyyset_lval
+%option noyyget_lloc
+%option noyyset_lloc
+%option noyyget_debug
+%option noyyset_debug
+%option noyyalloc
+%option noyyrealloc
+%option noyyfree
+/** @todo %option reentrant */
 %{
 /*	$NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $	*/
@@ -43,4 +73,5 @@
 #endif
 
+#include <stdio.h>
 #include "arith.h"
 #include "error.h"
@@ -56,4 +87,23 @@
 	result = (*buf = *arith_buf++) ? 1 : YY_NULL;
 #define YY_NO_UNPUT
+
+/* Avoid unnecessary libc bits. */
+#undef  ECHO
+#define ECHO \
+	do {} while (0)
+#undef  stdin
+#define stdin  \
+	NULL
+#undef  stdout
+#define stdout \
+	NULL
+#undef  fprintf
+#define fprintf(a, b, c) \
+	((void)0)
+#undef  exit
+#define exit(rc) \
+	do {} while (0)
+#define YY_FATAL_ERROR(msg) \
+	error(arith_psh, "arith: fatal error: %s", msg)
 %}
 
@@ -102,2 +152,21 @@
 #endif
 }
+
+void *
+yyalloc(yy_size_t cb)
+{
+	return sh_malloc(NULL, cb);
+}
+
+void *
+yyrealloc(void *pv, yy_size_t cb)
+{
+	return sh_realloc(NULL, pv, cb);
+}
+
+void
+yyfree(void *pv)
+{
+	sh_free(NULL, pv);
+}
+
Index: /trunk/src/kash/exec.h
===================================================================
--- /trunk/src/kash/exec.h	(revision 2414)
+++ /trunk/src/kash/exec.h	(revision 2415)
@@ -46,11 +46,13 @@
 
 
+union param {
+        int index;
+        int (*bltin)(struct shinstance*, int, char**);
+        union node *func;
+};
+
 struct cmdentry {
 	int cmdtype;
-	union param {
-		int index;
-		int (*bltin)(struct shinstance*, int, char**);
-		union node *func;
-	} u;
+        union param u;
 };
 
Index: /trunk/src/kash/generated/arith.c
===================================================================
--- /trunk/src/kash/generated/arith.c	(revision 2414)
+++ /trunk/src/kash/generated/arith.c	(revision 2415)
@@ -1,12 +1,34 @@
 #ifndef lint
-/*static char yysccsid[] = "from: @(#)yaccpar	1.9 (Berkeley) 02/21/93";*/
-static char yyrcsid[] = "$Id$";
-#endif
+static const char yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93";
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
 #define YYBYACC 1
 #define YYMAJOR 1
 #define YYMINOR 9
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING (yyerrflag!=0)
+#define YYPATCH 20091027
+
+#define YYEMPTY        (-1)
+#define yyclearin      (yychar = YYEMPTY)
+#define yyerrok        (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+#ifdef YYPARSE_PARAM_TYPE
+#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+#else
+#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+#endif
+#else
+#define YYPARSE_DECL() yyparse(void)
+#endif /* YYPARSE_PARAM */
+
+extern int YYPARSE_DECL();
+
+static int yygrowstack(void);
 #define YYPREFIX "yy"
 /*	$NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $	*/
@@ -67,4 +89,11 @@
 int main(int , char *[]);
 int error(char *);
+#else
+# undef  malloc
+# define malloc(cb)        sh_malloc(NULL, (cb))
+# undef  realloc
+# define realloc(pv,cb)    sh_realloc(NULL, (pv), (cb))
+# undef  free
+# define free(pv)          sh_free(NULL, (pv))
 #endif
 
@@ -95,15 +124,15 @@
 #define ARITH_BNOT 281
 #define YYERRCODE 256
-short yylhs[] = {                                        -1,
+static const short yylhs[] = {                           -1,
     0,    1,    1,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,
 };
-short yylen[] = {                                         2,
+static const short yylen[] = {                            2,
     1,    3,    3,    3,    3,    3,    3,    3,    3,    3,
     3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
     2,    2,    2,    2,    1,
 };
-short yydefred[] = {                                      0,
+static const short yydefred[] = {                         0,
    25,    0,    0,    0,    0,    0,    0,    0,    0,   24,
    23,   21,   22,    0,    0,    0,    0,    0,    0,    0,
@@ -112,8 +141,8 @@
     0,    0,    0,    0,    0,    0,    0,   18,   19,   20,
 };
-short yydgoto[] = {                                       7,
+static const short yydgoto[] = {                          7,
     8,
 };
-short yysindex[] = {                                   -255,
+static const short yysindex[] = {                      -255,
     0, -255, -255, -255, -255, -255,    0,  -67,  -85,    0,
     0,    0,    0, -255, -255, -255, -255, -255, -255, -255,
@@ -122,5 +151,5 @@
  -223, -223, -223, -253, -253, -248, -248,    0,    0,    0,
 };
-short yyrindex[] = {                                      0,
+static const short yyrindex[] = {                         0,
     0,    0,    0,    0,    0,    0,    0,   30,    0,    0,
     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -129,9 +158,9 @@
    73,   85,   97,   33,   47,    1,   17,    0,    0,    0,
 };
-short yygindex[] = {                                      0,
+static const short yygindex[] = {                         0,
   142,
 };
 #define YYTABLESIZE 418
-short yytable[] = {                                       0,
+static const short yytable[] = {                          0,
    16,    1,    2,   19,   20,   21,   22,   23,   24,   25,
    26,   27,   28,   29,   30,   31,   17,    3,    4,   27,
@@ -177,5 +206,5 @@
    24,   25,   26,   27,   28,   29,   30,   31,
 };
-short yycheck[] = {                                      -1,
+static const short yycheck[] = {                         -1,
     0,  257,  258,  265,  266,  267,  268,  269,  270,  271,
   272,  273,  274,  275,  276,  277,    0,  273,  274,  273,
@@ -227,5 +256,6 @@
 #define YYMAXTOKEN 281
 #if YYDEBUG
-char *yyname[] = {
+static const char *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,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -240,5 +270,5 @@
 "ARITH_REM","ARITH_UNARYMINUS","ARITH_UNARYPLUS","ARITH_NOT","ARITH_BNOT",
 };
-char *yyrule[] = {
+static const char *yyrule[] = {
 "$accept : exp",
 "exp : expr",
@@ -267,4 +297,5 @@
 "expr : ARITH_ADD expr",
 "expr : ARITH_NUM",
+
 };
 #endif
@@ -272,7 +303,12 @@
 typedef int YYSTYPE;
 #endif
+#if YYDEBUG
+#include <stdio.h>
+#endif
+
+/* define the initial stack-sizes */
 #ifdef YYSTACKSIZE
 #undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
+#define YYMAXDEPTH  YYSTACKSIZE
 #else
 #ifdef YYMAXDEPTH
@@ -280,18 +316,24 @@
 #else
 #define YYSTACKSIZE 500
-#define YYMAXDEPTH 500
-#endif
-#endif
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
+#define YYMAXDEPTH  500
+#endif
+#endif
+
+#define YYINITSTACKSIZE 500
+
+int      yydebug;
+int      yynerrs;
+int      yyerrflag;
+int      yychar;
+short   *yyssp;
 YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short yyss[YYSTACKSIZE];
-YYSTYPE yyvs[YYSTACKSIZE];
-#define yystacksize YYSTACKSIZE
+YYSTYPE  yyval;
+YYSTYPE  yylval;
+
+/* variables for the parser stack */
+static short   *yyss;
+static short   *yysslim;
+static YYSTYPE *yyvs;
+static unsigned yystacksize;
 int
 arith(shinstance *psh, const char *s)
@@ -370,6 +412,8 @@
 yyerror(const char *s)
 {
-   shinstance *psh = arith_psh;
+    shinstance *psh = arith_psh;
+#ifndef YYBISON /* yyerrok references yyerrstatus which is a local variable in yyparse().*/
 	yyerrok;
+#endif
 	yyclearin;
 	arith_lex_reset();	/* reprime lex */
@@ -378,31 +422,54 @@
 	/* NOTREACHED */
 }
-#define YYABORT goto yyabort
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(void)
+{
+    int i;
+    unsigned newsize;
+    short *newss;
+    YYSTYPE *newvs;
+
+    if ((newsize = yystacksize) == 0)
+        newsize = YYINITSTACKSIZE;
+    else if (newsize >= YYMAXDEPTH)
+        return -1;
+    else if ((newsize *= 2) > YYMAXDEPTH)
+        newsize = YYMAXDEPTH;
+
+    i = yyssp - yyss;
+    newss = (yyss != 0)
+          ? (short *)realloc(yyss, newsize * sizeof(*newss))
+          : (short *)malloc(newsize * sizeof(*newss));
+    if (newss == 0)
+        return -1;
+
+    yyss  = newss;
+    yyssp = newss + i;
+    newvs = (yyvs != 0)
+          ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs))
+          : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
+    if (newvs == 0)
+        return -1;
+
+    yyvs = newvs;
+    yyvsp = newvs + i;
+    yystacksize = newsize;
+    yysslim = yyss + newsize - 1;
+    return 0;
+}
+
+#define YYABORT  goto yyabort
 #define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
-#define YYERROR goto yyerrlab
-#ifdef __cplusplus
-extern "C" { 
-char * getenv();
-int yylex();
-int yyparse();
-}
-
-#endif
+#define YYERROR  goto yyerrlab
+
 int
-#if defined(__STDC__)
-yyparse(void)
-#else
-yyparse()
-#endif
+YYPARSE_DECL()
 {
-    register int yym, yyn, yystate;
-#if YYDEBUG
-    register char *yys;
-#ifndef __cplusplus
-    extern char *getenv();
-#endif
-
-    if (yys = getenv("YYDEBUG"))
+    int yym, yyn, yystate;
+#if YYDEBUG
+    const char *yys;
+
+    if ((yys = getenv("YYDEBUG")) != 0)
     {
         yyn = *yys;
@@ -414,9 +481,12 @@
     yynerrs = 0;
     yyerrflag = 0;
-    yychar = (-1);
-
+    yychar = YYEMPTY;
+    yystate = 0;
+
+    if (yyss == NULL && yygrowstack()) goto yyoverflow;
     yyssp = yyss;
     yyvsp = yyvs;
-    *yyssp = yystate = 0;
+    yystate = 0;
+    *yyssp = 0;
 
 yyloop:
@@ -444,11 +514,12 @@
                     YYPREFIX, yystate, yytable[yyn]);
 #endif
-        if (yyssp >= yyss + yystacksize - 1)
+        if (yyssp >= yysslim && yygrowstack())
         {
             goto yyoverflow;
         }
-        *++yyssp = yystate = yytable[yyn];
+        yystate = yytable[yyn];
+        *++yyssp = yytable[yyn];
         *++yyvsp = yylval;
-        yychar = (-1);
+        yychar = YYEMPTY;
         if (yyerrflag > 0)  --yyerrflag;
         goto yyloop;
@@ -461,10 +532,12 @@
     }
     if (yyerrflag) goto yyinrecovery;
+
     yyerror("syntax error");
-#ifdef lint
+
     goto yyerrlab;
-#endif
+
 yyerrlab:
     ++yynerrs;
+
 yyinrecovery:
     if (yyerrflag < 3)
@@ -481,9 +554,10 @@
  to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
 #endif
-                if (yyssp >= yyss + yystacksize - 1)
+                if (yyssp >= yysslim && yygrowstack())
                 {
                     goto yyoverflow;
                 }
-                *++yyssp = yystate = yytable[yyn];
+                yystate = yytable[yyn];
+                *++yyssp = yytable[yyn];
                 *++yyvsp = yylval;
                 goto yyloop;
@@ -515,7 +589,8 @@
         }
 #endif
-        yychar = (-1);
+        yychar = YYEMPTY;
         goto yyloop;
     }
+
 yyreduce:
 #if YYDEBUG
@@ -525,65 +600,68 @@
 #endif
     yym = yylen[yyn];
-    yyval = yyvsp[1-yym];
+    if (yym)
+        yyval = yyvsp[1-yym];
+    else
+        memset(&yyval, 0, sizeof yyval);
     switch (yyn)
     {
 case 1:
-{
+	{
 			return (yyvsp[0]);
 		}
 break;
 case 2:
-{ yyval = yyvsp[-1]; }
+	{ yyval = yyvsp[-1]; }
 break;
 case 3:
-{ yyval = yyvsp[-2] ? yyvsp[-2] : yyvsp[0] ? yyvsp[0] : 0; }
+	{ yyval = yyvsp[-2] ? yyvsp[-2] : yyvsp[0] ? yyvsp[0] : 0; }
 break;
 case 4:
-{ yyval = yyvsp[-2] ? ( yyvsp[0] ? yyvsp[0] : 0 ) : 0; }
+	{ yyval = yyvsp[-2] ? ( yyvsp[0] ? yyvsp[0] : 0 ) : 0; }
 break;
 case 5:
-{ yyval = yyvsp[-2] | yyvsp[0]; }
+	{ yyval = yyvsp[-2] | yyvsp[0]; }
 break;
 case 6:
-{ yyval = yyvsp[-2] ^ yyvsp[0]; }
+	{ yyval = yyvsp[-2] ^ yyvsp[0]; }
 break;
 case 7:
-{ yyval = yyvsp[-2] & yyvsp[0]; }
+	{ yyval = yyvsp[-2] & yyvsp[0]; }
 break;
 case 8:
-{ yyval = yyvsp[-2] == yyvsp[0]; }
+	{ yyval = yyvsp[-2] == yyvsp[0]; }
 break;
 case 9:
-{ yyval = yyvsp[-2] > yyvsp[0]; }
+	{ yyval = yyvsp[-2] > yyvsp[0]; }
 break;
 case 10:
-{ yyval = yyvsp[-2] >= yyvsp[0]; }
+	{ yyval = yyvsp[-2] >= yyvsp[0]; }
 break;
 case 11:
-{ yyval = yyvsp[-2] < yyvsp[0]; }
+	{ yyval = yyvsp[-2] < yyvsp[0]; }
 break;
 case 12:
-{ yyval = yyvsp[-2] <= yyvsp[0]; }
+	{ yyval = yyvsp[-2] <= yyvsp[0]; }
 break;
 case 13:
-{ yyval = yyvsp[-2] != yyvsp[0]; }
+	{ yyval = yyvsp[-2] != yyvsp[0]; }
 break;
 case 14:
-{ yyval = yyvsp[-2] << yyvsp[0]; }
+	{ yyval = yyvsp[-2] << yyvsp[0]; }
 break;
 case 15:
-{ yyval = yyvsp[-2] >> yyvsp[0]; }
+	{ yyval = yyvsp[-2] >> yyvsp[0]; }
 break;
 case 16:
-{ yyval = yyvsp[-2] + yyvsp[0]; }
+	{ yyval = yyvsp[-2] + yyvsp[0]; }
 break;
 case 17:
-{ yyval = yyvsp[-2] - yyvsp[0]; }
+	{ yyval = yyvsp[-2] - yyvsp[0]; }
 break;
 case 18:
-{ yyval = yyvsp[-2] * yyvsp[0]; }
+	{ yyval = yyvsp[-2] * yyvsp[0]; }
 break;
 case 19:
-{
+	{
 			if (yyvsp[0] == 0)
 				yyerror("division by zero");
@@ -592,5 +670,5 @@
 break;
 case 20:
-{
+	{
 			if (yyvsp[0] == 0)
 				yyerror("division by zero");
@@ -599,14 +677,14 @@
 break;
 case 21:
-{ yyval = !(yyvsp[0]); }
+	{ yyval = !(yyvsp[0]); }
 break;
 case 22:
-{ yyval = ~(yyvsp[0]); }
+	{ yyval = ~(yyvsp[0]); }
 break;
 case 23:
-{ yyval = -(yyvsp[0]); }
+	{ yyval = -(yyvsp[0]); }
 break;
 case 24:
-{ yyval = yyvsp[0]; }
+	{ yyval = yyvsp[0]; }
 break;
     }
@@ -652,15 +730,18 @@
 to state %d\n", YYPREFIX, *yyssp, yystate);
 #endif
-    if (yyssp >= yyss + yystacksize - 1)
+    if (yyssp >= yysslim && yygrowstack())
     {
         goto yyoverflow;
     }
-    *++yyssp = yystate;
+    *++yyssp = (short) yystate;
     *++yyvsp = yyval;
     goto yyloop;
+
 yyoverflow:
     yyerror("yacc stack overflow");
+
 yyabort:
     return (1);
+
 yyaccept:
     return (0);
Index: /trunk/src/kash/generated/arith_lex.c
===================================================================
--- /trunk/src/kash/generated/arith_lex.c	(revision 2414)
+++ /trunk/src/kash/generated/arith_lex.c	(revision 2415)
@@ -1,5 +1,5 @@
-#line 2 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
-
-#line 4 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
+#line 2 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
+
+#line 4 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
 
 #define  YY_INT_ALIGNED short int
@@ -478,6 +478,8 @@
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
-#line 1 "arith_lex.l"
-#line 3 "arith_lex.l"
+#line 1 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
+#define YY_NO_INPUT 1
+/** @todo %option reentrant */
+#line 33 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 /*	$NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $	*/
 
@@ -522,4 +524,5 @@
 #endif
 
+#include <stdio.h>
 #include "arith.h"
 #include "error.h"
@@ -535,5 +538,18 @@
 	result = (*buf = *arith_buf++) ? 1 : YY_NULL;
 #define YY_NO_UNPUT
-#line 538 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
+
+/* Avoid unnecessary libc bits. */
+#undef  ECHO
+#define ECHO \
+	do {} while (0)
+#undef  stdin
+#define stdin  \
+	NULL
+#undef  stdout
+#define stdout \
+	NULL
+#define YY_FATAL_ERROR(msg) \
+	error(arith_psh, "arith: fatal error: %s", msg)
+#line 554 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
 
 #define INITIAL 0
@@ -565,6 +581,4 @@
 #endif
 
-    static void yyunput (int c,char *buf_ptr  );
-    
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char *,yyconst char *,int );
@@ -688,7 +702,7 @@
 	register int yy_act;
     
-#line 60 "arith_lex.l"
-
-#line 693 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
+#line 104 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
+
+#line 707 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
 
 	if ( !(yy_init) )
@@ -749,14 +763,10 @@
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 48 );
+		while ( yy_current_state != 38 );
+		yy_cp = (yy_last_accepting_cpos);
+		yy_current_state = (yy_last_accepting_state);
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
-		if ( yy_act == 0 )
-			{ /* have to back up */
-			yy_cp = (yy_last_accepting_cpos);
-			yy_current_state = (yy_last_accepting_state);
-			yy_act = yy_accept[yy_current_state];
-			}
 
 		YY_DO_BEFORE_ACTION;
@@ -776,25 +786,25 @@
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 61 "arith_lex.l"
+#line 105 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { ; }
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 62 "arith_lex.l"
+#line 106 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); }
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 63 "arith_lex.l"
+#line 107 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); }
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 64 "arith_lex.l"
+#line 108 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 65 "arith_lex.l"
+#line 109 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { char *v = lookupvar(arith_psh, yytext);
 			if (v) {
@@ -808,123 +818,123 @@
 case 6:
 YY_RULE_SETUP
-#line 73 "arith_lex.l"
+#line 117 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_LPAREN); }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 74 "arith_lex.l"
+#line 118 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_RPAREN); }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 75 "arith_lex.l"
+#line 119 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_OR); }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 76 "arith_lex.l"
+#line 120 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_AND); }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 77 "arith_lex.l"
+#line 121 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_BOR); }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 78 "arith_lex.l"
+#line 122 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_BXOR); }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 79 "arith_lex.l"
+#line 123 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_BAND); }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 80 "arith_lex.l"
+#line 124 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_EQ); }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 81 "arith_lex.l"
+#line 125 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_NE); }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 82 "arith_lex.l"
+#line 126 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_GT); }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 83 "arith_lex.l"
+#line 127 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_GE); }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 84 "arith_lex.l"
+#line 128 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_LT); }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 85 "arith_lex.l"
+#line 129 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_LE); }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 86 "arith_lex.l"
+#line 130 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_LSHIFT); }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 87 "arith_lex.l"
+#line 131 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_RSHIFT); }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 88 "arith_lex.l"
+#line 132 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_MUL); }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 89 "arith_lex.l"
+#line 133 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_DIV); }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 90 "arith_lex.l"
+#line 134 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_REM); }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 91 "arith_lex.l"
+#line 135 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_ADD); }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 92 "arith_lex.l"
+#line 136 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_SUB); }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 93 "arith_lex.l"
+#line 137 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_BNOT); }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 94 "arith_lex.l"
+#line 138 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { return(ARITH_NOT); }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 95 "arith_lex.l"
+#line 139 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 { error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 96 "arith_lex.l"
+#line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 ECHO;
 	YY_BREAK
-#line 929 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
+#line 939 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
@@ -993,5 +1003,6 @@
 			else
 				{
-				yy_cp = (yy_c_buf_p);
+				yy_cp = (yy_last_accepting_cpos);
+				yy_current_state = (yy_last_accepting_state);
 				goto yy_find_action;
 				}
@@ -1247,41 +1258,4 @@
 }
 
-    static void yyunput (int c, register char * yy_bp )
-{
-	register char *yy_cp;
-    
-    yy_cp = (yy_c_buf_p);
-
-	/* undo effects of setting up yytext */
-	*yy_cp = (yy_hold_char);
-
-	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-		{ /* need to shift things up to make room */
-		/* +2 for EOB chars. */
-		register int number_to_move = (yy_n_chars) + 2;
-		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-		register char *source =
-				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
-		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			*--dest = *--source;
-
-		yy_cp += (int) (dest - source);
-		yy_bp += (int) (dest - source);
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
-			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
-		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-			YY_FATAL_ERROR( "flex scanner push-back overflow" );
-		}
-
-	*--yy_cp = (char) c;
-
-	(yytext_ptr) = yy_bp;
-	(yy_hold_char) = *yy_cp;
-	(yy_c_buf_p) = yy_cp;
-}
-
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
@@ -1332,5 +1306,5 @@
 					{
 					if ( yywrap( ) )
-						return EOF;
+						return 0;
 
 					if ( ! (yy_did_buffer_switch_on_eof) )
@@ -1468,18 +1442,4 @@
 }
 
-#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */
-#ifdef __cplusplus
-extern "C" {
-#endif
-#ifdef __THROW /* this is a gnuism */
-extern int isatty (int ) __THROW;
-#else
-extern int isatty (int );
-#endif
-#ifdef __cplusplus
-}
-#endif
-#endif
-    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
@@ -1505,5 +1465,5 @@
     }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+        b->yy_is_interactive = 0;
     
 	errno = oerrno;
@@ -1631,90 +1591,4 @@
 }
 
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * 
- * @return the newly allocated buffer state object. 
- */
-YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
-{
-	YY_BUFFER_STATE b;
-    
-	if ( size < 2 ||
-	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
-	     base[size-1] != YY_END_OF_BUFFER_CHAR )
-		/* They forgot to leave room for the EOB's. */
-		return 0;
-
-	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
-	if ( ! b )
-		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
-	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
-	b->yy_buf_pos = b->yy_ch_buf = base;
-	b->yy_is_our_buffer = 0;
-	b->yy_input_file = 0;
-	b->yy_n_chars = b->yy_buf_size;
-	b->yy_is_interactive = 0;
-	b->yy_at_bol = 1;
-	b->yy_fill_buffer = 0;
-	b->yy_buffer_status = YY_BUFFER_NEW;
-
-	yy_switch_to_buffer(b  );
-
-	return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
- * 
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- *       yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
-{
-    
-	return yy_scan_bytes(yystr,strlen(yystr) );
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
- * 
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
-{
-	YY_BUFFER_STATE b;
-	char *buf;
-	yy_size_t n;
-	int i;
-    
-	/* Get memory for full buffer, including space for trailing EOB's. */
-	n = _yybytes_len + 2;
-	buf = (char *) yyalloc(n  );
-	if ( ! buf )
-		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
-	for ( i = 0; i < _yybytes_len; ++i )
-		buf[i] = yybytes[i];
-
-	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-	b = yy_scan_buffer(buf,n );
-	if ( ! b )
-		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
-	/* It's okay to grow etc. this buffer, and we should throw it
-	 * away when we're done.
-	 */
-	b->yy_is_our_buffer = 1;
-
-	return b;
-}
-
 #ifndef YY_EXIT_FAILURE
 #define YY_EXIT_FAILURE 2
@@ -1746,81 +1620,7 @@
 /* Accessor  methods (get/set functions) to struct members. */
 
-/** Get the current line number.
- * 
- */
-int yyget_lineno  (void)
-{
-        
-    return yylineno;
-}
-
-/** Get the input stream.
- * 
- */
-FILE *yyget_in  (void)
-{
-        return yyin;
-}
-
-/** Get the output stream.
- * 
- */
-FILE *yyget_out  (void)
-{
-        return yyout;
-}
-
-/** Get the length of the current token.
- * 
- */
-int yyget_leng  (void)
-{
-        return yyleng;
-}
-
 /** Get the current token.
  * 
  */
-
-char *yyget_text  (void)
-{
-        return yytext;
-}
-
-/** Set the current line number.
- * @param line_number
- * 
- */
-void yyset_lineno (int  line_number )
-{
-    
-    yylineno = line_number;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- * 
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE *  in_str )
-{
-        yyin = in_str ;
-}
-
-void yyset_out (FILE *  out_str )
-{
-        yyout = out_str ;
-}
-
-int yyget_debug  (void)
-{
-        return yy_flex_debug;
-}
-
-void yyset_debug (int  bdebug )
-{
-        yy_flex_debug = bdebug ;
-}
 
 static int yy_init_globals (void)
@@ -1898,29 +1698,7 @@
 #endif
 
-void *yyalloc (yy_size_t  size )
-{
-	return (void *) malloc( size );
-}
-
-void *yyrealloc  (void * ptr, yy_size_t  size )
-{
-	/* The cast to (char *) in the following accommodates both
-	 * implementations that use char* generic pointers, and those
-	 * that use void* generic pointers.  It works with the latter
-	 * because both ANSI C and C++ allow castless assignment from
-	 * any pointer type to void*, and deal with argument conversions
-	 * as though doing an assignment.
-	 */
-	return (void *) realloc( (char *) ptr, size );
-}
-
-void yyfree (void * ptr )
-{
-	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
-}
-
 #define YYTABLES_NAME "yytables"
 
-#line 96 "arith_lex.l"
+#line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
 
 
@@ -1933,2 +1711,21 @@
 }
 
+void *
+yyalloc(yy_size_t cb)
+{
+	return sh_malloc(NULL, cb);
+}
+
+void *
+yyrealloc(void *pv,yy_size_t cb)
+{
+	return sh_realloc(NULL, pv, cb);
+}
+
+void
+yyfree(void *pv)
+{
+	sh_free(NULL, pv);
+}
+
+
Index: /trunk/src/kash/generated/init.c
===================================================================
--- /trunk/src/kash/generated/init.c	(revision 2414)
+++ /trunk/src/kash/generated/init.c	(revision 2415)
@@ -110,4 +110,22 @@
 #undef  STANDARD_BITS
 #define	STANDARD_BITS	(S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
+#undef  SHMEMHDR_MAGIC_FREE
+#define SHMEMHDR_MAGIC_FREE     0xbeeff00d
+#undef  SHMEMHDR_MAGIC_USED
+#define SHMEMHDR_MAGIC_USED     0xfeedface
+#undef  SHMEMCHUNK_MAGIC
+#define SHMEMCHUNK_MAGIC        0x12345678
+#undef  SHHEAP_MIN_CHUNK
+#define SHHEAP_MIN_CHUNK        0x80000 //(1024*1024)
+#undef  SHFILE_MAX
+#define SHFILE_MAX          1024
+#undef  SHFILE_GROW
+#define SHFILE_GROW         64
+#undef  SHFILE_UNIX_MIN_FD
+#define SHFILE_UNIX_MIN_FD  32
+#undef  SHFILE_MAX_PATH
+#define SHFILE_MAX_PATH     4096
+#undef  YY_NO_UNPUT
+#define YY_NO_UNPUT
 
 
@@ -132,20 +150,20 @@
 init(shinstance *psh) {
 
-      /* from exec.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */
       {
 	      hash_special_builtins(psh);
       }
 
-      /* from input.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */
       {
 	      psh->basepf.nextc = psh->basepf.buf = psh->basebuf;
       }
 
-      /* from options.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */
       {
 	      memcpy(&psh->optlist[0], &ro_optlist[0], sizeof(psh->optlist));
       }
 
-      /* from var.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */
       {
 	      char **envp;
@@ -170,5 +188,5 @@
 reset(shinstance *psh) {
 
-      /* from eval.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */
       {
 	      psh->evalskip = 0;
@@ -177,5 +195,5 @@
       }
 
-      /* from input.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */
       {
 	      if (psh->exception != EXSHELLPROC)
@@ -184,5 +202,5 @@
       }
 
-      /* from output.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/output.c: */
       {
 	      psh->out1 = &psh->output;
@@ -194,5 +212,5 @@
       }
 
-      /* from parser.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/parser.c: */
       {
 	      psh->tokpushback = 0;
@@ -200,5 +218,5 @@
       }
 
-      /* from redir.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */
       {
 	      while (psh->redirlist)
@@ -216,25 +234,25 @@
 initshellproc(shinstance *psh) {
 
-      /* from alias.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/alias.c: */
       {
 	      rmaliases(psh);
       }
 
-      /* from eval.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */
       {
 	      psh->exitstatus = 0;
       }
 
-      /* from exec.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */
       {
 	      deletefuncs(psh);
       }
 
-      /* from input.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */
       {
 	      popallfiles(psh);
       }
 
-      /* from jobs.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/jobs.c: */
       {
 	      psh->backgndpid = -1;
@@ -244,5 +262,5 @@
       }
 
-      /* from options.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */
       {
 	      int i;
@@ -254,10 +272,10 @@
       }
 
-      /* from redir.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */
       {
 	      clearredir(psh, 0);
       }
 
-      /* from trap.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/trap.c: */
       {
 	      char *sm;
@@ -270,5 +288,5 @@
       }
 
-      /* from var.c: */
+      /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */
       {
 	      shprocvar(psh);
Index: /trunk/src/kash/shfile.h
===================================================================
--- /trunk/src/kash/shfile.h	(revision 2414)
+++ /trunk/src/kash/shfile.h	(revision 2415)
@@ -173,5 +173,5 @@
 typedef struct shdir
 {
-    shfdtab    *shfdtab;
+    shfdtab    *pshfdtab;
     void       *native;
     shdirent    ent;
