[BusyBox] Ash superdiff

Aaron Lehmann aaronl at vitelus.com
Tue Aug 7 12:48:57 UTC 2001


Hi,

This diff contains a merge of my latest work on ash and (some of)
Vladimir's improvements.
-------------- next part --------------
Index: ash.c
===================================================================
RCS file: /var/cvs/busybox/ash.c,v
retrieving revision 1.17
diff -u -r1.17 ash.c
--- ash.c	2001/08/02 05:02:45	1.17
+++ ash.c	2001/08/07 18:46:38
@@ -142,13 +142,6 @@
 #define CSPCL 13                /* these terminate a word */
 #define CIGN 14                 /* character should be ignored */
 
-/* Syntax classes for is_ functions */
-#define ISDIGIT 01              /* a digit */
-#define ISUPPER 02              /* an upper case letter */
-#define ISLOWER 04              /* a lower case letter */
-#define ISUNDER 010             /* an underscore */
-#define ISSPECL 020             /* the name of a special parameter */
-
 #define SYNBASE 130
 #define PEOF -130
 
@@ -186,10 +179,6 @@
 #define TEND 29
 
 
-#define BASESYNTAX (basesyntax + SYNBASE)
-#define DQSYNTAX (dqsyntax + SYNBASE)
-#define SQSYNTAX (sqsyntax + SYNBASE)
-#define ARISYNTAX (arisyntax + SYNBASE)
 
 /* control characters in argument strings */
 #define CTLESC '\201'
@@ -202,11 +191,20 @@
 #define CTLENDARI '\207'
 #define CTLQUOTEMARK '\210'
 
-#define is_digit(c)     ((c)>='0' && (c)<='9')
+#define is_digit(c)     ((unsigned)(c) - '0' <= 9)
 #define is_alpha(c)     (((c) < CTLESC || (c) > CTLENDARI) && isalpha((unsigned char) (c)))
 #define is_name(c)      (((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalpha((unsigned char) (c))))
 #define is_in_name(c)   (((c) < CTLESC || (c) > CTLENDARI) && ((c) == '_' || isalnum((unsigned char) (c))))
-#define is_special(c)   ((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))
+
+/*
+ * is_special(c) evaluates to 1 for c in "!#$*-0123456789?@"; 0 otherwise
+ * (assuming ascii char codes, as the original implementation did)
+ */
+#define is_special(c) \
+    ( (((unsigned int)c) - 33 < 32) \
+                        && ((0xc1ff920dUL >> (((unsigned int)c) - 33)) & 1))
+
+
 #define digit_val(c)    ((c) - '0')
 
 
@@ -335,7 +333,7 @@
 static struct stack_block *stackp = &stackbase;
 static struct stackmark *markp;
 static char *stacknxt = stackbase.space;
-static int stacknleft = MINSIZE;
+static size_t stacknleft = MINSIZE;
 
 
 #define equal(s1, s2)   (strcmp(s1, s2) == 0)
@@ -697,384 +695,363 @@
 static void out2c(int c)           { putc(c, stderr); }
 #endif
 
+#define SIT (syntax_index_table + SYNBASE)
+
+#define CENDFILE_CENDFILE_CENDFILE_CENDFILE    0
+#define CSPCL_CIGN_CIGN_CIGN    1
+#define CWORD_CWORD_CWORD_CWORD    2
+#define CCTL_CCTL_CCTL_CCTL    3
+#define CSPCL_CWORD_CWORD_CWORD    4
+#define CNL_CNL_CNL_CNL    5
+#define CWORD_CCTL_CCTL_CWORD    6
+#define CDQUOTE_CENDQUOTE_CWORD_CDQUOTE    7
+#define CVAR_CVAR_CWORD_CVAR    8
+#define CSQUOTE_CWORD_CENDQUOTE_CSQUOTE    9
+#define CSPCL_CWORD_CWORD_CLP    10
+#define CSPCL_CWORD_CWORD_CRP    11
+#define CBACK_CBACK_CCTL_CBACK    12
+#define CBQUOTE_CBQUOTE_CWORD_CBQUOTE    13
+#define CENDVAR_CENDVAR_CWORD_CENDVAR    14
+
+static const char syntax_index_table[257] = {
+  /*   0 */  CENDFILE_CENDFILE_CENDFILE_CENDFILE,
+  /*   1 */  CSPCL_CIGN_CIGN_CIGN,
+  /*   2 */  CWORD_CWORD_CWORD_CWORD,
+  /*   3 */  CCTL_CCTL_CCTL_CCTL,
+  /*   4 */  CCTL_CCTL_CCTL_CCTL,
+  /*   5 */  CCTL_CCTL_CCTL_CCTL,
+  /*   6 */  CCTL_CCTL_CCTL_CCTL,
+  /*   7 */  CCTL_CCTL_CCTL_CCTL,
+  /*   8 */  CCTL_CCTL_CCTL_CCTL,
+  /*   9 */  CCTL_CCTL_CCTL_CCTL,
+  /*  10 */  CCTL_CCTL_CCTL_CCTL,
+  /*  11 */  CWORD_CWORD_CWORD_CWORD,
+  /*  12 */  CWORD_CWORD_CWORD_CWORD,
+  /*  13 */  CWORD_CWORD_CWORD_CWORD,
+  /*  14 */  CWORD_CWORD_CWORD_CWORD,
+  /*  15 */  CWORD_CWORD_CWORD_CWORD,
+  /*  16 */  CWORD_CWORD_CWORD_CWORD,
+  /*  17 */  CWORD_CWORD_CWORD_CWORD,
+  /*  18 */  CWORD_CWORD_CWORD_CWORD,
+  /*  19 */  CWORD_CWORD_CWORD_CWORD,
+  /*  20 */  CWORD_CWORD_CWORD_CWORD,
+  /*  21 */  CWORD_CWORD_CWORD_CWORD,
+  /*  22 */  CWORD_CWORD_CWORD_CWORD,
+  /*  23 */  CWORD_CWORD_CWORD_CWORD,
+  /*  24 */  CWORD_CWORD_CWORD_CWORD,
+  /*  25 */  CWORD_CWORD_CWORD_CWORD,
+  /*  26 */  CWORD_CWORD_CWORD_CWORD,
+  /*  27 */  CWORD_CWORD_CWORD_CWORD,
+  /*  28 */  CWORD_CWORD_CWORD_CWORD,
+  /*  29 */  CWORD_CWORD_CWORD_CWORD,
+  /*  30 */  CWORD_CWORD_CWORD_CWORD,
+  /*  31 */  CWORD_CWORD_CWORD_CWORD,
+  /*  32 */  CWORD_CWORD_CWORD_CWORD,
+  /*  33 */  CWORD_CWORD_CWORD_CWORD,
+  /*  34 */  CWORD_CWORD_CWORD_CWORD,
+  /*  35 */  CWORD_CWORD_CWORD_CWORD,
+  /*  36 */  CWORD_CWORD_CWORD_CWORD,
+  /*  37 */  CWORD_CWORD_CWORD_CWORD,
+  /*  38 */  CWORD_CWORD_CWORD_CWORD,
+  /*  39 */  CWORD_CWORD_CWORD_CWORD,
+  /*  40 */  CWORD_CWORD_CWORD_CWORD,
+  /*  41 */  CWORD_CWORD_CWORD_CWORD,
+  /*  42 */  CWORD_CWORD_CWORD_CWORD,
+  /*  43 */  CWORD_CWORD_CWORD_CWORD,
+  /*  44 */  CWORD_CWORD_CWORD_CWORD,
+  /*  45 */  CWORD_CWORD_CWORD_CWORD,
+  /*  46 */  CWORD_CWORD_CWORD_CWORD,
+  /*  47 */  CWORD_CWORD_CWORD_CWORD,
+  /*  48 */  CWORD_CWORD_CWORD_CWORD,
+  /*  49 */  CWORD_CWORD_CWORD_CWORD,
+  /*  50 */  CWORD_CWORD_CWORD_CWORD,
+  /*  51 */  CWORD_CWORD_CWORD_CWORD,
+  /*  52 */  CWORD_CWORD_CWORD_CWORD,
+  /*  53 */  CWORD_CWORD_CWORD_CWORD,
+  /*  54 */  CWORD_CWORD_CWORD_CWORD,
+  /*  55 */  CWORD_CWORD_CWORD_CWORD,
+  /*  56 */  CWORD_CWORD_CWORD_CWORD,
+  /*  57 */  CWORD_CWORD_CWORD_CWORD,
+  /*  58 */  CWORD_CWORD_CWORD_CWORD,
+  /*  59 */  CWORD_CWORD_CWORD_CWORD,
+  /*  60 */  CWORD_CWORD_CWORD_CWORD,
+  /*  61 */  CWORD_CWORD_CWORD_CWORD,
+  /*  62 */  CWORD_CWORD_CWORD_CWORD,
+  /*  63 */  CWORD_CWORD_CWORD_CWORD,
+  /*  64 */  CWORD_CWORD_CWORD_CWORD,
+  /*  65 */  CWORD_CWORD_CWORD_CWORD,
+  /*  66 */  CWORD_CWORD_CWORD_CWORD,
+  /*  67 */  CWORD_CWORD_CWORD_CWORD,
+  /*  68 */  CWORD_CWORD_CWORD_CWORD,
+  /*  69 */  CWORD_CWORD_CWORD_CWORD,
+  /*  70 */  CWORD_CWORD_CWORD_CWORD,
+  /*  71 */  CWORD_CWORD_CWORD_CWORD,
+  /*  72 */  CWORD_CWORD_CWORD_CWORD,
+  /*  73 */  CWORD_CWORD_CWORD_CWORD,
+  /*  74 */  CWORD_CWORD_CWORD_CWORD,
+  /*  75 */  CWORD_CWORD_CWORD_CWORD,
+  /*  76 */  CWORD_CWORD_CWORD_CWORD,
+  /*  77 */  CWORD_CWORD_CWORD_CWORD,
+  /*  78 */  CWORD_CWORD_CWORD_CWORD,
+  /*  79 */  CWORD_CWORD_CWORD_CWORD,
+  /*  80 */  CWORD_CWORD_CWORD_CWORD,
+  /*  81 */  CWORD_CWORD_CWORD_CWORD,
+  /*  82 */  CWORD_CWORD_CWORD_CWORD,
+  /*  83 */  CWORD_CWORD_CWORD_CWORD,
+  /*  84 */  CWORD_CWORD_CWORD_CWORD,
+  /*  85 */  CWORD_CWORD_CWORD_CWORD,
+  /*  86 */  CWORD_CWORD_CWORD_CWORD,
+  /*  87 */  CWORD_CWORD_CWORD_CWORD,
+  /*  88 */  CWORD_CWORD_CWORD_CWORD,
+  /*  89 */  CWORD_CWORD_CWORD_CWORD,
+  /*  90 */  CWORD_CWORD_CWORD_CWORD,
+  /*  91 */  CWORD_CWORD_CWORD_CWORD,
+  /*  92 */  CWORD_CWORD_CWORD_CWORD,
+  /*  93 */  CWORD_CWORD_CWORD_CWORD,
+  /*  94 */  CWORD_CWORD_CWORD_CWORD,
+  /*  95 */  CWORD_CWORD_CWORD_CWORD,
+  /*  96 */  CWORD_CWORD_CWORD_CWORD,
+  /*  97 */  CWORD_CWORD_CWORD_CWORD,
+  /*  98 */  CWORD_CWORD_CWORD_CWORD,
+  /*  99 */  CWORD_CWORD_CWORD_CWORD,
+  /* 100 */  CWORD_CWORD_CWORD_CWORD,
+  /* 101 */  CWORD_CWORD_CWORD_CWORD,
+  /* 102 */  CWORD_CWORD_CWORD_CWORD,
+  /* 103 */  CWORD_CWORD_CWORD_CWORD,
+  /* 104 */  CWORD_CWORD_CWORD_CWORD,
+  /* 105 */  CWORD_CWORD_CWORD_CWORD,
+  /* 106 */  CWORD_CWORD_CWORD_CWORD,
+  /* 107 */  CWORD_CWORD_CWORD_CWORD,
+  /* 108 */  CWORD_CWORD_CWORD_CWORD,
+  /* 109 */  CWORD_CWORD_CWORD_CWORD,
+  /* 110 */  CWORD_CWORD_CWORD_CWORD,
+  /* 111 */  CWORD_CWORD_CWORD_CWORD,
+  /* 112 */  CWORD_CWORD_CWORD_CWORD,
+  /* 113 */  CWORD_CWORD_CWORD_CWORD,
+  /* 114 */  CWORD_CWORD_CWORD_CWORD,
+  /* 115 */  CWORD_CWORD_CWORD_CWORD,
+  /* 116 */  CWORD_CWORD_CWORD_CWORD,
+  /* 117 */  CWORD_CWORD_CWORD_CWORD,
+  /* 118 */  CWORD_CWORD_CWORD_CWORD,
+  /* 119 */  CWORD_CWORD_CWORD_CWORD,
+  /* 120 */  CWORD_CWORD_CWORD_CWORD,
+  /* 121 */  CWORD_CWORD_CWORD_CWORD,
+  /* 122 */  CWORD_CWORD_CWORD_CWORD,
+  /* 123 */  CWORD_CWORD_CWORD_CWORD,
+  /* 124 */  CWORD_CWORD_CWORD_CWORD,
+  /* 125 */  CWORD_CWORD_CWORD_CWORD,
+  /* 126 */  CWORD_CWORD_CWORD_CWORD,
+  /* 127 */  CWORD_CWORD_CWORD_CWORD,
+  /* 128 */  CWORD_CWORD_CWORD_CWORD,
+  /* 129 */  CWORD_CWORD_CWORD_CWORD,
+  /* 130 */  CWORD_CWORD_CWORD_CWORD,
+  /* 131 */  CWORD_CWORD_CWORD_CWORD,
+  /* 132 */  CWORD_CWORD_CWORD_CWORD,
+  /* 133 */  CWORD_CWORD_CWORD_CWORD,
+  /* 134 */  CWORD_CWORD_CWORD_CWORD,
+  /* 135 */  CWORD_CWORD_CWORD_CWORD,
+  /* 136 */  CWORD_CWORD_CWORD_CWORD,
+  /* 137 */  CWORD_CWORD_CWORD_CWORD,
+  /* 138 */  CWORD_CWORD_CWORD_CWORD,
+  /* 139 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 140 */  CNL_CNL_CNL_CNL,
+  /* 141 */  CWORD_CWORD_CWORD_CWORD,
+  /* 142 */  CWORD_CWORD_CWORD_CWORD,
+  /* 143 */  CWORD_CWORD_CWORD_CWORD,
+  /* 144 */  CWORD_CWORD_CWORD_CWORD,
+  /* 145 */  CWORD_CWORD_CWORD_CWORD,
+  /* 146 */  CWORD_CWORD_CWORD_CWORD,
+  /* 147 */  CWORD_CWORD_CWORD_CWORD,
+  /* 148 */  CWORD_CWORD_CWORD_CWORD,
+  /* 149 */  CWORD_CWORD_CWORD_CWORD,
+  /* 150 */  CWORD_CWORD_CWORD_CWORD,
+  /* 151 */  CWORD_CWORD_CWORD_CWORD,
+  /* 152 */  CWORD_CWORD_CWORD_CWORD,
+  /* 153 */  CWORD_CWORD_CWORD_CWORD,
+  /* 154 */  CWORD_CWORD_CWORD_CWORD,
+  /* 155 */  CWORD_CWORD_CWORD_CWORD,
+  /* 156 */  CWORD_CWORD_CWORD_CWORD,
+  /* 157 */  CWORD_CWORD_CWORD_CWORD,
+  /* 158 */  CWORD_CWORD_CWORD_CWORD,
+  /* 159 */  CWORD_CWORD_CWORD_CWORD,
+  /* 160 */  CWORD_CWORD_CWORD_CWORD,
+  /* 161 */  CWORD_CWORD_CWORD_CWORD,
+  /* 162 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 163 */  CWORD_CCTL_CCTL_CWORD,
+  /* 164 */  CDQUOTE_CENDQUOTE_CWORD_CDQUOTE,
+  /* 165 */  CWORD_CWORD_CWORD_CWORD,
+  /* 166 */  CVAR_CVAR_CWORD_CVAR,
+  /* 167 */  CWORD_CWORD_CWORD_CWORD,
+  /* 168 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 169 */  CSQUOTE_CWORD_CENDQUOTE_CSQUOTE,
+  /* 170 */  CSPCL_CWORD_CWORD_CLP,
+  /* 171 */  CSPCL_CWORD_CWORD_CRP,
+  /* 172 */  CWORD_CCTL_CCTL_CWORD,
+  /* 173 */  CWORD_CWORD_CWORD_CWORD,
+  /* 174 */  CWORD_CWORD_CWORD_CWORD,
+  /* 175 */  CWORD_CCTL_CCTL_CWORD,
+  /* 176 */  CWORD_CWORD_CWORD_CWORD,
+  /* 177 */  CWORD_CCTL_CCTL_CWORD,
+  /* 178 */  CWORD_CWORD_CWORD_CWORD,
+  /* 179 */  CWORD_CWORD_CWORD_CWORD,
+  /* 180 */  CWORD_CWORD_CWORD_CWORD,
+  /* 181 */  CWORD_CWORD_CWORD_CWORD,
+  /* 182 */  CWORD_CWORD_CWORD_CWORD,
+  /* 183 */  CWORD_CWORD_CWORD_CWORD,
+  /* 184 */  CWORD_CWORD_CWORD_CWORD,
+  /* 185 */  CWORD_CWORD_CWORD_CWORD,
+  /* 186 */  CWORD_CWORD_CWORD_CWORD,
+  /* 187 */  CWORD_CWORD_CWORD_CWORD,
+  /* 188 */  CWORD_CCTL_CCTL_CWORD,
+  /* 189 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 190 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 191 */  CWORD_CCTL_CCTL_CWORD,
+  /* 192 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 193 */  CWORD_CCTL_CCTL_CWORD,
+  /* 194 */  CWORD_CWORD_CWORD_CWORD,
+  /* 195 */  CWORD_CWORD_CWORD_CWORD,
+  /* 196 */  CWORD_CWORD_CWORD_CWORD,
+  /* 197 */  CWORD_CWORD_CWORD_CWORD,
+  /* 198 */  CWORD_CWORD_CWORD_CWORD,
+  /* 199 */  CWORD_CWORD_CWORD_CWORD,
+  /* 200 */  CWORD_CWORD_CWORD_CWORD,
+  /* 201 */  CWORD_CWORD_CWORD_CWORD,
+  /* 202 */  CWORD_CWORD_CWORD_CWORD,
+  /* 203 */  CWORD_CWORD_CWORD_CWORD,
+  /* 204 */  CWORD_CWORD_CWORD_CWORD,
+  /* 205 */  CWORD_CWORD_CWORD_CWORD,
+  /* 206 */  CWORD_CWORD_CWORD_CWORD,
+  /* 207 */  CWORD_CWORD_CWORD_CWORD,
+  /* 208 */  CWORD_CWORD_CWORD_CWORD,
+  /* 209 */  CWORD_CWORD_CWORD_CWORD,
+  /* 210 */  CWORD_CWORD_CWORD_CWORD,
+  /* 211 */  CWORD_CWORD_CWORD_CWORD,
+  /* 212 */  CWORD_CWORD_CWORD_CWORD,
+  /* 213 */  CWORD_CWORD_CWORD_CWORD,
+  /* 214 */  CWORD_CWORD_CWORD_CWORD,
+  /* 215 */  CWORD_CWORD_CWORD_CWORD,
+  /* 216 */  CWORD_CWORD_CWORD_CWORD,
+  /* 217 */  CWORD_CWORD_CWORD_CWORD,
+  /* 218 */  CWORD_CWORD_CWORD_CWORD,
+  /* 219 */  CWORD_CWORD_CWORD_CWORD,
+  /* 220 */  CWORD_CWORD_CWORD_CWORD,
+  /* 221 */  CWORD_CCTL_CCTL_CWORD,
+  /* 222 */  CBACK_CBACK_CCTL_CBACK,
+  /* 223 */  CWORD_CCTL_CCTL_CWORD,
+  /* 224 */  CWORD_CWORD_CWORD_CWORD,
+  /* 225 */  CWORD_CWORD_CWORD_CWORD,
+  /* 226 */  CBQUOTE_CBQUOTE_CWORD_CBQUOTE,
+  /* 227 */  CWORD_CWORD_CWORD_CWORD,
+  /* 228 */  CWORD_CWORD_CWORD_CWORD,
+  /* 229 */  CWORD_CWORD_CWORD_CWORD,
+  /* 230 */  CWORD_CWORD_CWORD_CWORD,
+  /* 231 */  CWORD_CWORD_CWORD_CWORD,
+  /* 232 */  CWORD_CWORD_CWORD_CWORD,
+  /* 233 */  CWORD_CWORD_CWORD_CWORD,
+  /* 234 */  CWORD_CWORD_CWORD_CWORD,
+  /* 235 */  CWORD_CWORD_CWORD_CWORD,
+  /* 236 */  CWORD_CWORD_CWORD_CWORD,
+  /* 237 */  CWORD_CWORD_CWORD_CWORD,
+  /* 238 */  CWORD_CWORD_CWORD_CWORD,
+  /* 239 */  CWORD_CWORD_CWORD_CWORD,
+  /* 240 */  CWORD_CWORD_CWORD_CWORD,
+  /* 241 */  CWORD_CWORD_CWORD_CWORD,
+  /* 242 */  CWORD_CWORD_CWORD_CWORD,
+  /* 243 */  CWORD_CWORD_CWORD_CWORD,
+  /* 244 */  CWORD_CWORD_CWORD_CWORD,
+  /* 245 */  CWORD_CWORD_CWORD_CWORD,
+  /* 246 */  CWORD_CWORD_CWORD_CWORD,
+  /* 247 */  CWORD_CWORD_CWORD_CWORD,
+  /* 248 */  CWORD_CWORD_CWORD_CWORD,
+  /* 249 */  CWORD_CWORD_CWORD_CWORD,
+  /* 250 */  CWORD_CWORD_CWORD_CWORD,
+  /* 251 */  CWORD_CWORD_CWORD_CWORD,
+  /* 252 */  CWORD_CWORD_CWORD_CWORD,
+  /* 253 */  CWORD_CWORD_CWORD_CWORD,
+  /* 254 */  CSPCL_CWORD_CWORD_CWORD,
+  /* 255 */  CENDVAR_CENDVAR_CWORD_CENDVAR,
+  /* 256 */  CWORD_CCTL_CCTL_CWORD,
+};
+
 /* syntax table used when not in quotes */
-static const char basesyntax[257] = {
-      CENDFILE,   CSPCL,   CWORD,   CCTL,
-      CCTL,    CCTL,    CCTL,    CCTL,
-      CCTL,    CCTL,    CCTL,    CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CSPCL,
-      CNL,     CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CSPCL,   CWORD,
-      CDQUOTE, CWORD,   CVAR,    CWORD,
-      CSPCL,   CSQUOTE, CSPCL,   CSPCL,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CSPCL,   CSPCL,   CWORD,
-      CSPCL,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CBACK,   CWORD,
-      CWORD,   CWORD,   CBQUOTE, CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CSPCL,   CENDVAR,
-      CWORD
+static const char basesyntax[15] = {
+  CENDFILE,
+  CSPCL,
+  CWORD,
+  CCTL,
+  CSPCL,
+  CNL,
+  CWORD,
+  CDQUOTE,
+  CVAR,
+  CSQUOTE,
+  CSPCL,
+  CSPCL,
+  CBACK,
+  CBQUOTE,
+  CENDVAR,
 };
 
 /* syntax table used when in double quotes */
-static const char dqsyntax[257] = {
-      CENDFILE,   CIGN,    CWORD,   CCTL,
-      CCTL,    CCTL,    CCTL,    CCTL,
-      CCTL,    CCTL,    CCTL,    CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CNL,     CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CCTL,
-      CENDQUOTE,CWORD,  CVAR,    CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CCTL,    CWORD,   CWORD,   CCTL,
-      CWORD,   CCTL,    CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CCTL,    CWORD,   CWORD,   CCTL,
-      CWORD,   CCTL,    CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CCTL,    CBACK,   CCTL,
-      CWORD,   CWORD,   CBQUOTE, CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CENDVAR,
-      CCTL
+static const char dqsyntax[15] = {
+  CENDFILE,
+  CIGN,
+  CWORD,
+  CCTL,
+  CWORD,
+  CNL,
+  CCTL,
+  CENDQUOTE,
+  CVAR,
+  CWORD,
+  CWORD,
+  CWORD,
+  CBACK,
+  CBQUOTE,
+  CENDVAR,
 };
 
 /* syntax table used when in single quotes */
-static const char sqsyntax[257] = {
-      CENDFILE,   CIGN,    CWORD,   CCTL,
-      CCTL,    CCTL,    CCTL,    CCTL,
-      CCTL,    CCTL,    CCTL,    CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CNL,     CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CCTL,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CENDQUOTE,CWORD,  CWORD,
-      CCTL,    CWORD,   CWORD,   CCTL,
-      CWORD,   CCTL,    CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CCTL,    CWORD,   CWORD,   CCTL,
-      CWORD,   CCTL,    CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CCTL,    CCTL,    CCTL,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CCTL
+static const char sqsyntax[15] = {
+  CENDFILE,
+  CIGN,
+  CWORD,
+  CCTL,
+  CWORD,
+  CNL,
+  CCTL,
+  CWORD,
+  CWORD,
+  CENDQUOTE,
+  CWORD,
+  CWORD,
+  CCTL,
+  CWORD,
+  CWORD,
 };
 
 /* syntax table used when in arithmetic */
-static const char arisyntax[257] = {
-      CENDFILE,   CIGN,    CWORD,   CCTL,
-      CCTL,    CCTL,    CCTL,    CCTL,
-      CCTL,    CCTL,    CCTL,    CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CNL,     CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CDQUOTE, CWORD,   CVAR,    CWORD,
-      CWORD,   CSQUOTE, CLP,     CRP,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CBACK,   CWORD,
-      CWORD,   CWORD,   CBQUOTE, CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CWORD,
-      CWORD,   CWORD,   CWORD,   CENDVAR,
-      CWORD
-};
-
-/* character classification table */
-static const char is_type[257] = {
-      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,       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,       0,       0,
-      0,       0,       0,       0,
-      0,       0,       0,       0,
-      0,       0,       0,       0,
-      0,       0,       0,       ISSPECL,
-      0,       ISSPECL, ISSPECL, 0,
-      0,       0,       0,       0,
-      ISSPECL, 0,       0,       ISSPECL,
-      0,       0,       ISDIGIT, ISDIGIT,
-      ISDIGIT, ISDIGIT, ISDIGIT, ISDIGIT,
-      ISDIGIT, ISDIGIT, ISDIGIT, ISDIGIT,
-      0,       0,       0,       0,
-      0,       ISSPECL, ISSPECL, ISUPPER,
-      ISUPPER, ISUPPER, ISUPPER, ISUPPER,
-      ISUPPER, ISUPPER, ISUPPER, ISUPPER,
-      ISUPPER, ISUPPER, ISUPPER, ISUPPER,
-      ISUPPER, ISUPPER, ISUPPER, ISUPPER,
-      ISUPPER, ISUPPER, ISUPPER, ISUPPER,
-      ISUPPER, ISUPPER, ISUPPER, ISUPPER,
-      ISUPPER, 0,       0,       0,
-      0,       ISUNDER, 0,       ISLOWER,
-      ISLOWER, ISLOWER, ISLOWER, ISLOWER,
-      ISLOWER, ISLOWER, ISLOWER, ISLOWER,
-      ISLOWER, ISLOWER, ISLOWER, ISLOWER,
-      ISLOWER, ISLOWER, ISLOWER, ISLOWER,
-      ISLOWER, ISLOWER, ISLOWER, ISLOWER,
-      ISLOWER, ISLOWER, ISLOWER, ISLOWER,
-      ISLOWER, 0,       0,       0,
-      0
-};
-
-/* Array indicating which tokens mark the end of a list */
-static const char tokendlist[] = {
-	1,
-	0,
-	0,
-	0,
-	0,
-	0,
-	0,
-	0,
-	1,
-	1,
-	1,
-	0,
-	0,
-	0,
-	0,
-	0,
-	1,
-	1,
-	1,
-	1,
-	1,
-	1,
-	0,
-	0,
-	0,
-	1,
-	0,
-	0,
-	0,
-	1,
-};
+static const char arisyntax[15] = {
+  CENDFILE,
+  CIGN,
+  CWORD,
+  CCTL,
+  CWORD,
+  CNL,
+  CWORD,
+  CDQUOTE,
+  CVAR,
+  CSQUOTE,
+  CLP,
+  CRP,
+  CBACK,
+  CBQUOTE,
+  CENDVAR,
+};
+  
+/* Bitmask indicating which tokens mark the end of a list */
+/* Equivilent to binary 100000001110000011111100010001 */
+static const unsigned int tokendlist = 0x20383F11;
 
 static const char *const tokname[] = {
 	"end of file",
@@ -1565,32 +1542,6 @@
  * written implementation written by Aaron Lehmann <aaronl at vitelus.com>.  
  * This is now part of libbb, so that it can be used by all the shells 
  * in busybox. */
-#define ARITH_NUM 257
-#define ARITH_LPAREN 258
-#define ARITH_RPAREN 259
-#define ARITH_OR 260
-#define ARITH_AND 261
-#define ARITH_BOR 262
-#define ARITH_BXOR 263
-#define ARITH_BAND 264
-#define ARITH_EQ 265
-#define ARITH_NE 266
-#define ARITH_LT 267
-#define ARITH_GT 268
-#define ARITH_GE 269
-#define ARITH_LE 270
-#define ARITH_LSHIFT 271
-#define ARITH_RSHIFT 272
-#define ARITH_ADD 273
-#define ARITH_SUB 274
-#define ARITH_MUL 275
-#define ARITH_DIV 276
-#define ARITH_REM 277
-#define ARITH_UNARYMINUS 278
-#define ARITH_UNARYPLUS 279
-#define ARITH_NOT 280
-#define ARITH_BNOT 281
-
 static void expari (int);
 #endif
 
@@ -3656,7 +3607,7 @@
 	const char *p;
 	char *q;
 	const char *start;
-	int len;
+	size_t len;
 
 	if (*path == NULL)
 		return NULL;
@@ -4430,7 +4381,7 @@
 #endif
 #if !(defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(FNMATCH_BROKEN) && !defined(GLOB_BROKEN))
 static struct strlist *expsort (struct strlist *);
-static struct strlist *msort (struct strlist *, int);
+static struct strlist *msort (struct strlist *, size_t);
 #endif
 static int patmatch (char *, char *, int);
 #if defined(__GLIBC__) && __GLIBC__ >= 2 && !defined(FNMATCH_BROKEN)
@@ -4566,7 +4517,7 @@
 				strtodest(
 					val,
 					varflags & VSQUOTE ?
-						DQSYNTAX : BASESYNTAX,
+						dqsyntax : basesyntax,
 					quotes
 				);
 			}
@@ -4781,7 +4732,7 @@
 	if (*home == '\0')
 		goto lose;
 	*p = c;
-	strtodest(home, SQSYNTAX, quotes);
+	strtodest(home, sqsyntax, quotes);
 	return (p);
 lose:
 	*p = c;
@@ -4916,7 +4867,7 @@
 	struct nodelist *volatile saveargbackq;
 	char lastc;
 	int startloc = dest - stackblock();
-	char const *syntax = quoted? DQSYNTAX : BASESYNTAX;
+	char const *syntax = quoted? dqsyntax : basesyntax;
 	volatile int saveherefd;
 	int quotes = flag & (EXP_FULL | EXP_CASE);
 	struct jmploc jmploc;
@@ -4973,7 +4924,7 @@
 		}
 		lastc = *p++;
 		if (lastc != '\0') {
-			if (quotes && syntax[(int)lastc] == CCTL)
+			if (quotes && syntax[(int)(SIT[(int)lastc])] == CCTL)
 				STPUTC(CTLESC, dest);
 			STPUTC(lastc, dest);
 		}
@@ -5180,7 +5131,7 @@
 	int quotes;
 {
 	while (*p) {
-		if (quotes && syntax[(int) *p] == CCTL)
+		if (quotes && syntax[(int)(SIT[(int) *p])] == CCTL)
 			STPUTC(CTLESC, expdest);
 		STPUTC(*p++, expdest);
 	}
@@ -5206,7 +5157,7 @@
 	int allow_split = flags & EXP_FULL;
 	int quotes = flags & (EXP_FULL | EXP_CASE);
 
-	syntax = quoted ? DQSYNTAX : BASESYNTAX;
+	syntax = quoted ? dqsyntax : basesyntax;
 	switch (*name) {
 	case '$':
 		num = rootpid;
@@ -5237,7 +5188,7 @@
 	case '*':
 		sep = ifsset() ? ifsval()[0] : ' ';
 		if (quotes) {
-			sepq = syntax[(int) sep] == CCTL;
+			sepq = syntax[(int)(SIT[(int) sep])] == CCTL;
 		}
 param:
 		for (ap = shellparam.p ; (p = *ap++) != NULL ; ) {
@@ -5674,7 +5625,7 @@
 expsort(str)
 	struct strlist *str;
 	{
-	int len;
+	size_t len;
 	struct strlist *sp;
 
 	len = 0;
@@ -5687,7 +5638,7 @@
 static struct strlist *
 msort(list, len)
 	struct strlist *list;
-	int len;
+	size_t len;
 {
 	struct strlist *p, *q = NULL;
 	struct strlist **lpp;
@@ -5988,7 +5939,7 @@
 	int num;
 	char *buf;
 	{
-	int len;
+	size_t len;
 
 	CHECKSTRSPACE(32, buf);
 	len = sprintf(buf, "%d", num);
@@ -6139,7 +6090,7 @@
  */
 
 static inline char *
-pfgets(char *line, int len)
+pfgets(char *line, size_t len)
 {
 	char *p = line;
 	int nleft = len;
@@ -6312,7 +6263,7 @@
  * We handle aliases this way.
  */
 static void
-pushstring(char *s, int len, void *ap)
+pushstring(char *s, size_t len, void *ap)
 {
 	struct strpush *sp;
 
@@ -7486,7 +7437,6 @@
 
 static void waitonint(int sig) {
 	intreceived = 1;
-	return;
 }
 /*
  * Routines to check for mail.  (Perhaps make part of main.c?)
@@ -8017,7 +7967,7 @@
 
 
 static inline void
-grabstackblock(int len)
+grabstackblock(size_t len)
 {
 	len = ALIGN(len);
 	stacknxt += len;
@@ -8047,7 +7997,7 @@
 
 static char *
 growstackstr(void) {
-	int len = stackblocksize();
+	size_t len = stackblocksize();
 	if (herefd >= 0 && len >= 1024) {
 		xwrite(herefd, stackblock(), len);
 		sstrnleft = len - 1;
@@ -8065,7 +8015,7 @@
 
 static char *
 makestrspace(size_t newlen) {
-	int len = stackblocksize() - sstrnleft;
+	size_t len = stackblocksize() - sstrnleft;
 	do {
 		growstackblock();
 		sstrnleft = stackblocksize() - len;
@@ -9391,7 +9341,7 @@
 	int tok;
 
 	checkkwd = 2;
-	if (nlflag == 0 && tokendlist[peektoken()])
+	if (nlflag == 0 && (tokendlist & (0x20000000 >> peektoken())))
 		return NULL;
 	n1 = NULL;
 	for (;;) {
@@ -9434,7 +9384,7 @@
 				tokpushback++;
 			}
 			checkkwd = 2;
-			if (tokendlist[peektoken()])
+			if (tokendlist & (0x20000000 >> peektoken()))
 				return n1;
 			break;
 		case TEOF:
@@ -9890,7 +9840,7 @@
 			setprompt(2);
 			needprompt = 0;
 		}
-		readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX,
+		readtoken1(pgetc(), here->here->type == NHERE? sqsyntax : dqsyntax,
 				here->eofmark, here->striptabs);
 		n = (union node *)stalloc(sizeof (struct narg));
 		n->narg.type = NARG;
@@ -10077,7 +10027,7 @@
 		}
 	}
 breakloop:
-	return readtoken1(c, BASESYNTAX, (char *)NULL, 0);
+	return readtoken1(c, basesyntax, (char *)NULL, 0);
 #undef RETURN
 }
 
@@ -10111,7 +10061,7 @@
 	{
 	int c = firstc;
 	char *out;
-	int len;
+	size_t len;
 	char line[EOFMARKLEN + 1];
 	struct nodelist *bqlist;
 	int quotef;
@@ -10138,7 +10088,7 @@
 
 	startlinno = plinno;
 	dblquote = 0;
-	if (syntax == DQSYNTAX)
+	if (syntax == dqsyntax)
 		dblquote = 1;
 	quotef = 0;
 	bqlist = NULL;
@@ -10152,9 +10102,9 @@
 		CHECKEND();     /* set c to PEOF if at end of here document */
 		for (;;) {      /* until end of line or end of word */
 			CHECKSTRSPACE(3, out);  /* permit 3 calls to USTPUTC */
-			switch(syntax[c]) {
+			switch(syntax[(int)(SIT[c])]) {
 			case CNL:       /* '\n' */
-				if (syntax == BASESYNTAX)
+				if (syntax == basesyntax)
 					goto endword;   /* exit outer loop */
 				USTPUTC(c, out);
 				plinno++;
@@ -10187,7 +10137,7 @@
 					if (dblquote && c != '\\' && c != '`' && c != '$'
 							 && (c != '"' || eofmark != NULL))
 						USTPUTC('\\', out);
-					if (SQSYNTAX[c] == CCTL)
+					if (sqsyntax[(int)(SIT[c])] == CCTL)
 						USTPUTC(CTLESC, out);
 					else if (eofmark == NULL)
 						USTPUTC(CTLQUOTEMARK, out);
@@ -10198,12 +10148,12 @@
 			case CSQUOTE:
 				if (eofmark == NULL)
 					USTPUTC(CTLQUOTEMARK, out);
-				syntax = SQSYNTAX;
+				syntax = sqsyntax;
 				break;
 			case CDQUOTE:
 				if (eofmark == NULL)
 					USTPUTC(CTLQUOTEMARK, out);
-				syntax = DQSYNTAX;
+				syntax = dqsyntax;
 				dblquote = 1;
 				break;
 			case CENDQUOTE:
@@ -10212,11 +10162,11 @@
 					USTPUTC(c, out);
 				} else {
 					if (arinest) {
-						syntax = ARISYNTAX;
+						syntax = arisyntax;
 						dblquote = 0;
 					} else if (eofmark == NULL &&
 						   dqvarnest == 0) {
-						syntax = BASESYNTAX;
+						syntax = basesyntax;
 						dblquote = 0;
 					}
 					quotef++;
@@ -10250,7 +10200,7 @@
 						if (--arinest == 0) {
 							USTPUTC(CTLENDARI, out);
 							syntax = prevsyntax;
-							if (syntax == DQSYNTAX)
+							if (syntax == dqsyntax)
 								dblquote = 1;
 							else
 								dblquote = 0;
@@ -10287,9 +10237,9 @@
 		}
 	}
 endword:
-	if (syntax == ARISYNTAX)
+	if (syntax == arisyntax)
 		synerror("Missing '))'");
-	if (syntax != BASESYNTAX && ! parsebackquote && eofmark == NULL)
+	if (syntax != basesyntax && ! parsebackquote && eofmark == NULL)
 		synerror("Unterminated quoted string");
 	if (varnest != 0) {
 		startlinno = plinno;
@@ -10691,7 +10641,7 @@
 
 	if (++arinest == 1) {
 		prevsyntax = syntax;
-		syntax = ARISYNTAX;
+		syntax = arisyntax;
 		USTPUTC(CTLARI, out);
 		if (dblquote)
 			USTPUTC('"',out);
@@ -10728,7 +10678,7 @@
 			continue;
 		if (c == CTLESC)
 			p++;
-		else if (BASESYNTAX[(int)c] == CCTL)
+		else if (basesyntax[(int)(SIT[(int)c])] == CCTL)
 			return 0;
 	}
 	return 1;
@@ -10769,10 +10719,10 @@
 	char msg[64];
 
 	if (token >= 0) {
-		snprintf(msg, 64, "%s unexpected (expecting %s)",
+		sprintf(msg, "%s unexpected (expecting %s)",
 			tokname[lasttoken], tokname[token]);
 	} else {
-		snprintf(msg, 64, "%s unexpected", tokname[lasttoken]);
+		sprintf(msg, "%s unexpected", tokname[lasttoken]);
 	}
 	synerror(msg);
 	/* NOTREACHED */
@@ -10892,7 +10842,7 @@
 openhere(const union node *redir)
 {
 	int pip[2];
-	int len = 0;
+	size_t len = 0;
 
 	if (pipe(pip) < 0)
 		error("Pipe call failed");
@@ -12259,8 +12209,8 @@
 	int flags;
 {
 	const char *p;
-	int len;
-	int namelen;
+	size_t len;
+	size_t namelen;
 	char *nameeq;
 	int isbad;
 	int vallen = 0;
@@ -12757,7 +12707,7 @@
 		for (vp = *vpp ; vp ; vp = vp->next) {
 			if ((vp->flags & mask) ^ xor) {
 				char *p;
-				int len;
+				size_t len;
 
 				p = strchr(vp->text, '=') + 1;
 				len = p - vp->text;


More information about the busybox mailing list