]> git.mdlowis.com Git - proto/rc.git/commitdiff
Moved all includes into rc.h and did a bit of hack and slash
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 15 Mar 2017 00:44:26 +0000 (20:44 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 15 Mar 2017 00:44:26 +0000 (20:44 -0400)
24 files changed:
.gitignore
Makefile
builtins.c
edit.c [deleted file]
except.c
exec.c
fn.c
glob.c
glom.c
input.c
lex.c
main.c
open.c
parse.c [deleted file]
parse.h [deleted file]
print.c
rc.h
sigmsgs.c
signal.c
utils.c
var.c
wait.c
walk.c
which.c

index b9c42081e203f46038a5f99e877012771bd5faa8..9c84a58140b8fcc40c81e0db6e1a3217fce73716 100644 (file)
@@ -3,3 +3,4 @@ rc
 mkstatval
 statval.h
 tags
+y.tab.*
index 1c013baf4ca7826888efb8229782959f04ee2d63..b9d28dec55eb45e95190883586debba430e939c8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
+CC = c99
 CPPFLAGS = -I.
 CCCMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)
-RCOBJS = builtins.o except.o exec.o fn.o footobar.o getopt.o glob.o glom.o hash.o heredoc.o input.o lex.o list.o main.o match.o nalloc.o open.o parse.o print.o redir.o signal.o status.o tree.o utils.o var.o wait.o walk.o which.o sigmsgs.o edit.o system.o
+RCOBJS = builtins.o except.o exec.o fn.o footobar.o getopt.o glob.o glom.o hash.o heredoc.o input.o lex.o list.o main.o match.o nalloc.o open.o y.tab.o print.o redir.o signal.o status.o tree.o utils.o var.o wait.o walk.o which.o sigmsgs.o system.o
 
 all: rc
 
@@ -10,32 +11,13 @@ statval.h: mkstatval
        ./mkstatval > statval.h
 status.o: statval.h
 
+lex.o: y.tab.h
+y.tab.c y.tab.h: parse.y
+       $(YACC) -d $<
+
 rc: $(RCOBJS)
        $(CCCMD)
 
 clean:
-       $(RM) rc *.o mkstatval statval.h
-
-
-#sigmsgs.o   # generated 
-#edit-null.o # selected by autoconf
-#system.o    # selected by autoconf
-
-# line editing config
-#edit-edit.c
-#edit-editline.c
-#edit-null.c
-#edit-readline.c
-#edit-vrl.c
-#history.c
-
-# system configs
-#system-bsd.c
-#system.c
-
-# helper utils
-#mksignal.c
-#mkstatval.c
+       $(RM) rc *.o mkstatval statval.h y.tab.*
 
-# unused
-#tripping.c
index 96a706562e06730abbe2882e77ecad97afc4813d..5349c22bac423aefb3e9b270d51b5fc371f3caca 100644 (file)
@@ -9,11 +9,6 @@
 
 #include "rc.h"
 
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <setjmp.h>
-#include <errno.h>
-
 static void b_break(char **), b_cd(char **), b_eval(char **), b_exit(char **),
        b_newpgrp(char **), b_return(char **), b_shift(char **), b_umask(char **),
        b_wait(char **), b_whatis(char **), b_limit(char **), b_echo(char **);
diff --git a/edit.c b/edit.c
deleted file mode 100644 (file)
index c583cdf..0000000
--- a/edit.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "rc.h"
-
-#include <errno.h>
-
-#include <sys/types.h>
-
-bool editing = 0;
-
-void *edit_begin(int fd) {
-       assert(0); /* should never be called */
-       return NULL;
-}
-
-char *edit_alloc(void *cookie, size_t *count) {
-       assert(0); /* should never be called */
-       return NULL;
-}
-
-void edit_prompt(void *cookie, char *prompt) {
-       assert(0); /* should never be called */
-}
-
-void edit_free(void *buffer) {
-       assert(0); /* should never be called */
-}
-
-void edit_end(void *cookie) {
-       assert(0); /* should never be called */
-}
-
-void edit_reset(void *cookie) {
-       assert(0); /* should never be called */
-}
index 83951fbe92ac28e2fb55d338c0a430f001b7dc46..b78688cd78ceeda02fc2a62450b80bf28fe6bf46 100644 (file)
--- a/except.c
+++ b/except.c
@@ -1,8 +1,5 @@
 #include "rc.h"
 
-#include <setjmp.h>
-#include <signal.h>
-
 /*
    A return goes back stack frames to the last return. A break does
    not. A signal goes to the last interactive level. (see below)
diff --git a/exec.c b/exec.c
index 055e53f0eee1341d22acd9ff6552132ceab4fa0b..2136a9607f2ded97e5cdc24556fb19522cc7c580 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -2,9 +2,6 @@
 
 #include "rc.h"
 
-#include <errno.h>
-#include <signal.h>
-
 /*
    Takes an argument list and does the appropriate thing (calls a
    builtin, calls a function, etc.)
diff --git a/fn.c b/fn.c
index ac898955ea30672ae634db66b70b813b40f5576f..5e610e9a0792cb2c15e673f5e12ba43cccd16e32 100644 (file)
--- a/fn.c
+++ b/fn.c
@@ -5,9 +5,6 @@
 
 #include "rc.h"
 
-#include <signal.h>
-#include <errno.h>
-
 static void fn_handler(int), dud_handler(int);
 
 static bool runexit = FALSE;
diff --git a/glob.c b/glob.c
index 18f62f473f8e741a900b2d02a92b5a5c2674d2f3..4d199c830946c39aa22fb9dca289f4d7281c5930 100644 (file)
--- a/glob.c
+++ b/glob.c
@@ -1,10 +1,8 @@
 /* glob.c: rc's (ugly) globber. This code is not elegant, but it works */
 
 #include "rc.h"
-#include <sys/stat.h>
 
 /* Lifted from autoconf documentation.*/
-#include <dirent.h>
 #define NAMLEN(dirent) strlen((dirent)->d_name)
 
 static List *dmatch(char *, char *, char *);
diff --git a/glom.c b/glom.c
index 2414f9f912b5ce311383b12960fdebfc863dadd7..86d3cf16198cd327112255ae6ee8967db8733364 100644 (file)
--- a/glom.c
+++ b/glom.c
@@ -2,10 +2,6 @@
 
 #include "rc.h"
 
-#include <sys/stat.h>
-#include <signal.h>
-#include <errno.h>
-
 static List *backq(Node *, Node *);
 static List *bqinput(List *, int);
 static List *count(List *);
diff --git a/input.c b/input.c
index e8d17fcef5e53b349d45187961dd0383e22c5e28..697a04195f09917e1a07aa3659b4c55fc74a505c 100644 (file)
--- a/input.c
+++ b/input.c
@@ -2,8 +2,6 @@
 
 #include "rc.h"
 
-#include <errno.h>
-
 /* How many characters can we unget? */
 enum { UNGETSIZE = 2 };
 
@@ -128,33 +126,6 @@ static int fdgchar() {
        return lastchar = inbuf[chars_out++];
 }
 
-/* read a character from a line-editing file descriptor */
-
-static int editgchar() {
-       if (chars_out >= chars_in) { /* replenish empty buffer */
-               edit_free(istack->cookie);
-               inbuf = edit_alloc(istack->cookie, &chars_in);
-               if (inbuf == NULL) {
-                       chars_in = 0;
-                       fprint(2, "exit\n");
-                       return lastchar = EOF;
-               }
-
-               chars_out = 0;
-               if (dashvee)
-                       writeall(2, inbuf, chars_in);
-               history();
-       }
-
-       return lastchar = inbuf[chars_out++];
-}
-
-void termchange(void) {
-       if (istack->t == iEdit)
-               edit_reset(istack->cookie);
-}
-
-
 /* set up the input stack, and put a "dead" input at the bottom, so that yyparse will always read eof */
 
 extern void initinput() {
@@ -189,15 +160,9 @@ extern void pushfd(int fd) {
        save_lineno = TRUE;
        istack->fd = fd;
        lineno = 1;
-       if (editing && interactive && isatty(fd)) {
-               istack->t = iEdit;
-               istack->gchar = editgchar;
-               istack->cookie = edit_begin(fd);
-       } else {
-               istack->t = iFd;
-               istack->gchar = fdgchar;
-               inbuf = ealloc(BUFSIZE);
-       }
+       istack->t = iFd;
+       istack->gchar = fdgchar;
+       inbuf = ealloc(BUFSIZE);
 }
 
 extern void pushstring(char **a, bool save) {
@@ -216,8 +181,6 @@ extern void pushstring(char **a, bool save) {
 /* remove an input source from the stack. restore associated variables etc. */
 
 extern void popinput() {
-       if (istack->t == iEdit)
-               edit_end(istack->cookie);
        if (istack->t == iFd || istack->t == iEdit)
                close(istack->fd);
        efree(inbuf);
@@ -294,8 +257,6 @@ extern Node *doit(bool clobberexecit) {
                        }
                        if (istack->t == iFd)
                                fprint(2, "%s", prompt);
-                       else if (istack->t == iEdit)
-                               edit_prompt(istack->cookie, prompt);
                }
                inityy();
                if (yyparse() == 1 && execit)
@@ -347,7 +308,5 @@ extern void nextline() {
        if (interactive) {
                if (istack->t == iFd)
                        fprint(2, "%s", prompt2);
-               else if (istack->t == iEdit)
-                       edit_prompt(istack->cookie, prompt2);
        }
 }
diff --git a/lex.c b/lex.c
index 4005535920005929eb074d8bb2c92583a9db8ec9..d487896b672beac5155a01a02b458d9bbfe8a3aa 100644 (file)
--- a/lex.c
+++ b/lex.c
@@ -1,7 +1,7 @@
 /* lex.c: rc's lexical analyzer */
 
 #include "rc.h"
-#include "parse.h"
+#include "y.tab.h"
 
 /*
        Special characters (i.e., "non-word") in rc:
diff --git a/main.c b/main.c
index 222235a2968c37eb5848779a916b06531ebd7a37..72f309c73d7e498b42d77af96a5a23c0cd436da3 100644 (file)
--- a/main.c
+++ b/main.c
@@ -2,8 +2,6 @@
 
 #include "rc.h"
 
-#include <errno.h>
-
 bool dashdee, dashee, dashvee, dashex, dasheye,
        dashen, dashpee, interactive;
 pid_t rc_pid;
diff --git a/open.c b/open.c
index 60555b032b5b18f3a39822e616b56c29fe4288e4..f7932c28ec25033e9c802218b6561f829a0f2a66 100644 (file)
--- a/open.c
+++ b/open.c
@@ -1,7 +1,6 @@
 /* open.c: to insulate <fcntl.h> from the rest of rc. */
 
 #include "rc.h"
-#include <fcntl.h>
 
 /*
    Opens a file with the necessary flags. Assumes the following
diff --git a/parse.c b/parse.c
deleted file mode 100644 (file)
index 1275ab5..0000000
--- a/parse.c
+++ /dev/null
@@ -1,1117 +0,0 @@
-#ifndef lint
-static char const 
-yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
-#endif
-#include "rc.h"
-#include <stdlib.h>
-#define YYBYACC 1
-#define YYMAJOR 1
-#define YYMINOR 9
-#define YYLEX yylex()
-#define YYEMPTY -1
-#define yyclearin (yychar=(YYEMPTY))
-#define yyerrok (yyerrflag=0)
-#define YYRECOVERING() (yyerrflag!=0)
-static int yygrowstack();
-#define YYPREFIX "yy"
-#line 8 "parse.y"
-
-static Node *star, *nolist;
-Node *parsetree;       /* not using yylval because bison declares it as an auto */
-#line 26 "parse.y"
-typedef union {
-       struct Node *node;
-       struct Redir redir;
-       struct Pipe pipe;
-       struct Dup dup;
-       struct Word word;
-       char *keyword;
-} YYSTYPE;
-#line 31 "y.tab.c"
-#define YYERRCODE 256
-#define ANDAND 257
-#define BACKBACK 258
-#define BANG 259
-#define CASE 260
-#define COUNT 261
-#define DUP 262
-#define ELSE 263
-#define END 264
-#define FLAT 265
-#define FN 266
-#define FOR 267
-#define IF 268
-#define IN 269
-#define OROR 270
-#define PIPE 271
-#define REDIR 272
-#define SREDIR 273
-#define SUB 274
-#define SUBSHELL 275
-#define SWITCH 276
-#define TWIDDLE 277
-#define WHILE 278
-#define WORD 279
-#define HUH 280
-const short yylhs[] = {                                        -1,
-    0,    0,   22,   22,    8,    8,   13,   13,    3,    3,
-    9,    9,    4,   15,    2,   11,   11,   16,   16,   16,
-    5,    5,    6,    6,    6,   19,   19,    7,    7,    7,
-    7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
-    7,    7,    7,    7,    7,   24,   24,   18,   18,   18,
-   12,   12,   17,   17,   20,   20,   10,   10,   10,   10,
-   10,   10,   10,   10,   10,   10,   10,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,   21,   21,
-   14,   14,   14,   23,   23,
-};
-const short yylen[] = {                                         2,
-    2,    2,    1,    1,    2,    2,    1,    2,    1,    2,
-    1,    2,    3,    3,    3,    0,    2,    1,    2,    2,
-    3,    3,    1,    2,    2,    1,    4,    0,    1,    2,
-    4,    8,    6,    4,    8,    4,    4,    4,    4,    2,
-    2,    3,    3,    3,    2,    0,    1,    1,    2,    2,
-    1,    3,    1,    1,    1,    3,    2,    5,    2,    2,
-    2,    2,    3,    3,    3,    2,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    0,    2,
-    0,    2,    2,    0,    2,
-};
-const short yydefred[] = {                                      0,
-    0,    0,    0,    0,   18,    0,   79,    0,    0,    0,
-    0,    0,    0,    0,    0,   67,    0,    0,   81,    0,
-    0,    0,    0,    0,    0,   51,    0,    0,    0,    0,
-    3,    4,    2,   77,   75,   74,   73,   68,   71,   69,
-    0,   78,   72,   76,   70,   54,   53,   55,    0,   47,
-    0,   59,   60,    0,    0,    0,   84,   66,    0,    0,
-    0,    0,    0,   84,    0,    0,    0,   11,    0,    0,
-   62,   61,    0,    0,   30,    0,   84,   84,   84,    5,
-    6,    8,    0,    0,    1,    0,   50,    0,    0,   63,
-   64,    0,   44,    0,    0,    0,    0,    0,    0,    0,
-    0,   79,   13,   12,   10,   65,   82,    0,   17,    0,
-    0,    0,    0,   52,   56,   79,   84,   14,   85,    0,
-    0,   31,   84,    0,    0,    0,    0,    0,   39,    0,
-    0,   84,    0,   58,   84,    0,    0,    0,    0,    0,
-   79,    0,    0,    0,    0,    0,    0,   24,   35,   25,
-   22,   21,
-};
-const short yydgoto[] = {                                      21,
-   46,   22,   66,   23,  142,  143,   67,   68,   69,   47,
-   75,   27,   28,   70,   57,   29,   48,   30,  122,   94,
-   54,   33,   97,   51,
-};
-const short yysindex[] = {                                    874,
-   24, 1001,  -82, 1001,    0, 1001,    0,  -27,  -26,  900,
- 1001,  -82,  -20,  -82,  -26,    0, 1001, 1134,    0,  900,
-    0, 1134, -203,  -30, 1134,    0,  -55,   24, 1134,  826,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-  -66,    0,    0,    0,    0,    0,    0,    0,  849,    0,
- 1134,    0,    0,  900, 1001, 1134,    0,    0,  -52,  -52,
- 1134, 1001, 1001,    0, -212,  -58,  154,    0, 1134,  426,
-    0,    0, -196, 1001,    0, -203,    0,    0,    0,    0,
-    0,    0, 1001, 1001,    0, -196,    0,  -52, 1001,    0,
-    0, -196,    0,  -52,  -38,   36,  502, -196,  -36,  -52,
-  502,    0,    0,    0,    0,    0,    0,  -52,    0,  502,
-  502,  502,  -52,    0,    0,    0,    0,    0,    0,  -97,
- -234,    0,    0, 1001, -234,  922, -196, -196,    0,  944,
-  502,    0,   -9,    0,    0, -234,  502,  967,  502, -234,
-    0,  967,  -45,  154,  967, -234,  448,    0,    0,    0,
-    0,    0,
-};
-const short yyrindex[] = {                                    134,
-    0,    0,  356,    0,    0,    0,    0,    0,    0,    0,
-    0,  356,    0, 1024,    0,    0,    0,  571,    0,    0,
-    0,  487,  529,   54,  134,    0,   62,    0,  487,  548,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-  487,    0,    0,  712,    0,  142,    0,    0,   14,   38,
-  487,    0,    0,    0,  -10,    0,  -32,    0,  744,    0,
-    0,    0,  749,    0,    0,  529,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,  763,    0,   86,    0,    0,
-    0,  779,    0,  110,    0,    0,  -34,  788,    0,  380,
-  -34,    0,    0,    0,    0,    0,    0,  470,    0,  -34,
-  -34,  -34,  404,    0,    0,    0,    0,    0,    0,  529,
-    6,    0,    0,  724,   30,    0,  805,  813,    0,    0,
-  -34,    0,    0,    0,    0,  119,  -34,  571,  -34,  187,
-    0,  571,    0,  -44,  571,  396,    0,    0,    0,    0,
-    0,    0,
-};
-const short yygindex[] = {                                      0,
-    0,    0,  -23,   12,    0, -104, 1319,    2, -127, 1307,
-    7,    0,   57,    0,   70,  -13,   84,    0,    0,  420,
-  -81,   59,  369,   31,
-};
-#define YYTABLESIZE 1464
-const short yytable[] = {                                      57,
-  119,   25,  117,   28,  123,   83,   28,   81,    9,   76,
-  145,   50,   55,   56,  145,   26,   87,  145,  124,   62,
-  126,   58,   77,   19,   28,   57,   25,   57,   80,   57,
-   57,   71,   96,   32,  130,   78,   79,  148,   84,   34,
-  150,   89,   61,   26,   63,  105,   26,   20,   57,   19,
-   57,   19,   58,   19,   19,   89,   18,   89,    5,  147,
-   90,  102,   76,    7,   26,   93,  103,   34,   74,   11,
-   34,   48,   19,   20,   79,   20,  118,   20,   20,  149,
-   23,   82,  109,   57,   64,   57,   85,   52,   34,   53,
-   28,    0,    9,    0,    0,   49,   20,   48,    0,   48,
-   65,   48,   48,   72,    0,    0,   76,    0,  120,   19,
-    0,    0,   57,  138,   57,    0,    0,    0,    0,   80,
-   48,   49,    0,   49,    0,   49,   49,    0,   33,    0,
-   26,    0,   91,   20,    0,    0,   19,    0,   19,    0,
-    0,    0,    0,   28,   49,   80,    0,   80,    0,   80,
-   80,   28,    0,    0,   34,    0,   33,   48,    0,   33,
-   20,    0,   20,  104,    5,  132,    0,  114,   80,    0,
-    0,   28,  115,    0,   74,   11,    0,   33,    0,   28,
-    0,   49,   28,    0,    0,    0,   48,    0,    0,    0,
-    0,   81,   28,    0,    0,    0,   27,    0,    0,    0,
-   28,    0,    0,    0,    0,   80,    0,    0,    0,    0,
-   49,    0,   80,    0,    0,    0,    0,    0,    0,    0,
-    0,    0,   28,    0,   27,    0,   77,   27,    0,   28,
-  116,    0,   80,    0,   80,   28,   28,    0,    0,   78,
-   79,    0,    0,   33,    0,   27,   57,   57,   57,   57,
-   57,   57,   57,   57,   57,   57,   57,   57,   57,   57,
-   57,   57,   57,    0,   57,   57,   57,   57,   57,   26,
-   19,   19,   19,   19,   19,   19,   19,   19,   19,   19,
-   19,   19,   19,   19,   19,   19,   19,   31,   19,   19,
-   19,   19,   19,   34,   20,   20,   20,   20,   20,   20,
-   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
-   20,   27,   20,   20,   20,   20,   20,    7,   48,   48,
-   48,   48,   48,   48,   48,   48,   48,   48,   48,   48,
-   48,   48,   48,   48,   48,    0,   48,   48,   48,   48,
-   48,    0,   49,   49,   49,   49,   49,   49,   49,   49,
-   49,   49,   49,   49,   49,   49,   49,   49,   49,    0,
-   49,   49,   49,   49,   49,   46,   80,   80,   80,   80,
-   80,    0,   80,   80,   80,   80,   80,   80,   80,   80,
-   80,   80,   33,    0,   80,   80,   80,   80,   80,   79,
-   28,   46,    0,   46,    0,   46,   46,   28,   28,    0,
-    0,    0,    0,   28,   28,   32,    0,    0,    0,    0,
-   77,   28,   28,   15,   46,   79,    0,   79,    0,   79,
-   79,   49,    0,   78,   79,    0,    0,    0,    0,   59,
-   60,    0,  101,   32,    0,  107,   32,    0,   79,   15,
-    0,   15,    0,   15,   15,  110,  111,  112,    0,   88,
-   27,   46,    0,    0,   32,    0,    0,  151,    0,    0,
-    0,   17,   15,    0,    0,   19,  106,    0,    0,    0,
-    0,    0,    0,    0,   95,   79,    0,    0,   46,   83,
-   46,   99,  100,   17,    0,  131,    0,   19,    0,  108,
-    0,  133,    0,   59,    0,    0,   28,    0,    0,   15,
-  137,    0,  113,  139,   79,   83,  152,    0,    0,   83,
-   83,  119,    0,    0,    0,    0,    0,    0,    0,    0,
-   32,   20,    0,    0,   28,    0,   15,   28,   15,    0,
-    0,    0,    0,    0,    0,    0,    0,   17,   16,    0,
-    0,   19,    0,   20,    0,   28,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,   29,    0,    0,
-    0,    0,    0,    0,    0,   83,   16,    0,    0,   16,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-   28,    0,    0,    0,    0,   29,    0,   16,   29,    0,
-    0,    0,    0,    0,    0,    0,    0,   20,    0,    0,
-    0,    0,    0,    0,    0,    0,   29,    0,   28,    0,
-    0,   28,   46,   46,   46,    0,   46,   46,    0,   46,
-   46,   46,   46,   46,   18,   46,   46,   46,   46,   28,
-   46,   46,   46,   46,   46,    0,   79,   79,   79,   79,
-   79,    0,   79,   79,   79,   79,   79,   79,   79,   79,
-   79,   79,    0,   16,   79,   79,   79,   79,   79,   32,
-   15,   15,   15,    0,   15,   15,    0,   15,   15,   15,
-   15,   15,   29,   15,   15,   15,   15,    0,   15,   15,
-   15,   15,   15,    2,   34,   35,    4,    0,   36,    0,
-    6,   37,   38,   39,   40,   28,    0,   41,    0,    0,
-   42,   43,   44,   45,   16,    2,   34,   35,    4,    0,
-   36,    0,    6,   37,   38,   39,   40,    0,    0,   41,
-    0,   45,   42,   43,   44,   45,   16,   83,   83,   83,
-   83,    0,   83,   36,   83,   83,   83,   83,   83,    0,
-    0,   83,    0,   28,   83,   83,   83,   83,   83,   45,
-   28,    0,   45,   28,    0,    0,   28,   28,   41,    2,
-    3,   36,    4,    5,   36,    0,    6,    7,    8,    9,
-   45,    0,   40,   10,   11,    0,   12,   13,   14,   15,
-   16,   28,   36,    0,   28,   16,   41,    0,   42,   41,
-    0,    0,   16,    0,    0,    0,    0,   43,   16,   16,
-   40,    0,   28,   40,   29,    0,    0,   41,    0,    0,
-    0,   29,    0,    0,   37,    0,   42,   29,   29,   42,
-    0,   40,   38,    0,    0,   43,    0,   28,   43,    0,
-    0,    0,    0,    0,    0,    0,   45,   42,    0,    0,
-   28,   28,   37,    0,    0,   37,   43,    0,   36,    0,
-   38,    0,    0,   38,    0,    0,    0,    0,    0,    0,
-    0,   17,    0,   37,    0,   19,    0,    0,   28,    0,
-    0,   38,    0,   41,    0,    0,    0,    0,    0,    0,
-    0,    0,    0,    0,   17,    0,    0,   40,   19,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-    0,    0,    0,   42,    0,    0,    0,    0,    0,   17,
-    0,    0,   43,   19,    0,    0,    0,    0,    0,    0,
-    0,   20,    0,    0,    0,    0,    0,    0,    0,   37,
-    0,    0,    0,    0,    0,   17,    0,   38,    0,   19,
-    0,    0,   89,    0,   20,    0,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,   17,    0,    0,
-    0,   19,  134,    0,    0,    0,    0,    0,   45,   20,
-    0,   18,    0,    0,    0,   45,    0,    0,    0,   17,
-   36,   45,   45,   19,  135,    0,    0,   36,    0,    0,
-    0,    0,    0,   36,   36,   20,   18,    0,    0,    0,
-   28,    0,   17,    0,    0,   41,   19,    0,    0,    0,
-    0,    0,   41,   28,   28,    0,    0,   20,   41,   40,
-    0,    0,   18,    0,    0,    0,   40,    0,    0,    0,
-    0,    0,   40,    0,    0,   42,   17,    0,    0,   20,
-   19,    0,   42,    0,   43,    0,    0,    0,   42,    0,
-    0,   43,    0,    0,    0,    0,    0,   43,    0,   46,
-    0,   37,   20,   46,    0,    0,    0,    0,   37,   38,
-    0,    0,    0,    0,   37,    0,   38,    0,    0,    0,
-    0,    0,   38,    2,   34,   35,    4,    5,   36,   18,
-    6,   37,   38,   39,   40,    0,   20,   10,   11,    0,
-   42,   43,   44,   45,   16,    0,    2,   34,   35,    4,
-    0,   36,    0,    6,   37,   38,   39,   40,    0,   46,
-   41,    0,    0,   42,   43,   44,   45,   16,    0,    1,
-    0,    2,    3,    0,    4,    5,    0,    0,    6,    7,
-    8,    9,    0,    0,    0,   10,   11,    0,   12,   13,
-   14,   15,   16,    0,    0,    0,    0,    2,   34,   35,
-    4,    0,   36,    0,    6,   37,   38,   39,   40,   17,
-    0,   41,    0,   19,   42,   43,   44,   45,   16,    2,
-   34,   35,    4,    0,   36,    0,    6,   37,   38,   39,
-   40,    0,    0,   41,    0,    0,   42,   43,   44,   45,
-   16,    2,   34,   35,    4,    0,   36,    0,    6,   37,
-   38,   39,   40,    0,    0,   41,    0,    0,   42,   43,
-   44,   45,   16,    0,    2,    3,  141,    4,    5,   20,
-    0,    6,    7,    8,    9,    0,    0,    0,   10,   11,
-    0,   12,   13,   14,   15,   16,    0,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,   18,    0,    2,   34,
-   35,    4,    0,   36,    0,    6,   37,   38,   39,   40,
-    0,    0,   41,    0,    0,   42,   43,   44,   45,   16,
-    0,   46,   46,   46,   46,    0,   46,    0,   46,   46,
-   46,   46,   46,    0,    0,   46,    0,    0,   46,   46,
-   46,   46,   46,    0,    0,    0,   26,    0,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,    0,   24,    0,
-    0,    0,    0,    0,   26,    0,    0,    0,   26,    0,
-    0,   26,    0,    0,    0,   26,    0,    0,    0,    0,
-   73,    0,    0,   24,    0,    0,    0,   86,    0,    0,
-    0,    0,    0,    0,    0,    0,    0,   26,    0,    0,
-    0,    0,   26,    0,    0,    0,    0,   26,    0,   92,
-    0,    0,    0,    0,    0,   26,    0,    0,    0,   98,
-    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-    0,    2,    3,    0,    4,    5,    0,    0,    6,    7,
-    8,    9,    0,   26,    0,   10,   11,   26,   12,   13,
-   14,   15,   16,    0,    0,  121,   26,   26,   26,  125,
-    0,    0,    0,    0,    0,    0,    0,    0,  127,  128,
-  129,    0,    0,    0,    0,    0,    0,   26,    0,    0,
-    0,    0,    0,   26,   26,   26,    0,    0,   26,  136,
-    0,   26,    0,    0,    0,  140,  144,  146,    0,    0,
-  144,    0,    0,  144,
-};
-const short yycheck[] = {                                      10,
-   10,    0,   41,   38,   41,   61,   41,   38,   41,   23,
-  138,   94,   40,   40,  142,   10,   30,  145,  100,   40,
-  102,   10,  257,   10,   59,   36,   25,   38,   59,   40,
-   41,   20,   56,   10,  116,  270,  271,  142,   94,   10,
-  145,   94,   12,   38,   14,   69,   41,   10,   59,   36,
-   61,   38,   41,   40,   41,   94,  123,   94,  262,  141,
-   49,  274,   76,   10,   59,   54,  125,   38,  272,  273,
-   41,   10,   59,   36,  271,   38,   41,   40,   41,  125,
-  125,   25,   76,   94,   15,   96,   28,    4,   59,    6,
-  125,   -1,  125,   -1,   -1,   10,   59,   36,   -1,   38,
-   17,   40,   41,   20,   -1,   -1,  120,   -1,   97,   96,
-   -1,   -1,  123,  123,  125,   -1,   -1,   -1,   -1,   10,
-   59,   36,   -1,   38,   -1,   40,   41,   -1,   10,   -1,
-  125,   -1,   49,   96,   -1,   -1,  123,   -1,  125,   -1,
-   -1,   -1,   -1,   10,   59,   36,   -1,   38,   -1,   40,
-   41,   10,   -1,   -1,  125,   -1,   38,   96,   -1,   41,
-  123,   -1,  125,   10,  262,  263,   -1,   84,   59,   -1,
-   -1,   38,   89,   -1,  272,  273,   -1,   59,   -1,   38,
-   -1,   96,   41,   -1,   -1,   -1,  125,   -1,   -1,   -1,
-   -1,   38,   59,   -1,   -1,   -1,   10,   -1,   -1,   -1,
-   59,   -1,   -1,   -1,   -1,   96,   -1,   -1,   -1,   -1,
-  125,   -1,   59,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,  257,   -1,   38,   -1,  257,   41,   -1,  264,
-  269,   -1,  123,   -1,  125,  270,  271,   -1,   -1,  270,
-  271,   -1,   -1,  125,   -1,   59,  257,  258,  259,  260,
-  261,  262,  263,  264,  265,  266,  267,  268,  269,  270,
-  271,  272,  273,   -1,  275,  276,  277,  278,  279,  264,
-  257,  258,  259,  260,  261,  262,  263,  264,  265,  266,
-  267,  268,  269,  270,  271,  272,  273,  264,  275,  276,
-  277,  278,  279,  264,  257,  258,  259,  260,  261,  262,
-  263,  264,  265,  266,  267,  268,  269,  270,  271,  272,
-  273,  125,  275,  276,  277,  278,  279,  264,  257,  258,
-  259,  260,  261,  262,  263,  264,  265,  266,  267,  268,
-  269,  270,  271,  272,  273,   -1,  275,  276,  277,  278,
-  279,   -1,  257,  258,  259,  260,  261,  262,  263,  264,
-  265,  266,  267,  268,  269,  270,  271,  272,  273,   -1,
-  275,  276,  277,  278,  279,   10,  257,  258,  259,  260,
-  261,   -1,  263,  264,  265,  266,  267,  268,  269,  270,
-  271,  272,  264,   -1,  275,  276,  277,  278,  279,   10,
-  257,   36,   -1,   38,   -1,   40,   41,  264,  257,   -1,
-   -1,   -1,   -1,  270,  271,   10,   -1,   -1,   -1,   -1,
-  257,  270,  271,   10,   59,   36,   -1,   38,   -1,   40,
-   41,    2,   -1,  270,  271,   -1,   -1,   -1,   -1,   10,
-   11,   -1,   64,   38,   -1,   10,   41,   -1,   59,   36,
-   -1,   38,   -1,   40,   41,   77,   78,   79,   -1,   30,
-  264,   96,   -1,   -1,   59,   -1,   -1,   10,   -1,   -1,
-   -1,   36,   59,   -1,   -1,   40,   41,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   55,   96,   -1,   -1,  123,   10,
-  125,   62,   63,   36,   -1,  117,   -1,   40,   -1,   70,
-   -1,  123,   -1,   74,   -1,   -1,   10,   -1,   -1,   96,
-  132,   -1,   83,  135,  125,   36,   59,   -1,   -1,   40,
-   41,   10,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-  125,   96,   -1,   -1,   38,   -1,  123,   41,  125,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   36,   10,   -1,
-   -1,   40,   -1,   96,   -1,   59,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   10,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   96,   38,   -1,   -1,   41,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-   10,   -1,   -1,   -1,   -1,   38,   -1,   59,   41,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   96,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   59,   -1,   38,   -1,
-   -1,  125,  257,  258,  259,   -1,  261,  262,   -1,  264,
-  265,  266,  267,  268,  123,  270,  271,  272,  273,   59,
-  275,  276,  277,  278,  279,   -1,  257,  258,  259,  260,
-  261,   -1,  263,  264,  265,  266,  267,  268,  269,  270,
-  271,  272,   -1,  125,  275,  276,  277,  278,  279,  264,
-  257,  258,  259,   -1,  261,  262,   -1,  264,  265,  266,
-  267,  268,  125,  270,  271,  272,  273,   -1,  275,  276,
-  277,  278,  279,  258,  259,  260,  261,   -1,  263,   -1,
-  265,  266,  267,  268,  269,  125,   -1,  272,   -1,   -1,
-  275,  276,  277,  278,  279,  258,  259,  260,  261,   -1,
-  263,   -1,  265,  266,  267,  268,  269,   -1,   -1,  272,
-   -1,   10,  275,  276,  277,  278,  279,  258,  259,  260,
-  261,   -1,  263,   10,  265,  266,  267,  268,  269,   -1,
-   -1,  272,   -1,  257,  275,  276,  277,  278,  279,   38,
-  264,   -1,   41,   10,   -1,   -1,  270,  271,   10,  258,
-  259,   38,  261,  262,   41,   -1,  265,  266,  267,  268,
-   59,   -1,   10,  272,  273,   -1,  275,  276,  277,  278,
-  279,   38,   59,   -1,   41,  257,   38,   -1,   10,   41,
-   -1,   -1,  264,   -1,   -1,   -1,   -1,   10,  270,  271,
-   38,   -1,   59,   41,  257,   -1,   -1,   59,   -1,   -1,
-   -1,  264,   -1,   -1,   10,   -1,   38,  270,  271,   41,
-   -1,   59,   10,   -1,   -1,   38,   -1,  257,   41,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,  125,   59,   -1,   -1,
-  270,  271,   38,   -1,   -1,   41,   59,   -1,  125,   -1,
-   38,   -1,   -1,   41,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   36,   -1,   59,   -1,   40,   -1,   -1,  125,   -1,
-   -1,   59,   -1,  125,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   36,   -1,   -1,  125,   40,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,  125,   -1,   -1,   -1,   -1,   -1,   36,
-   -1,   -1,  125,   40,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,   96,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  125,
-   -1,   -1,   -1,   -1,   -1,   36,   -1,  125,   -1,   40,
-   -1,   -1,   94,   -1,   96,   -1,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   36,   -1,   -1,
-   -1,   40,   41,   -1,   -1,   -1,   -1,   -1,  257,   96,
-   -1,  123,   -1,   -1,   -1,  264,   -1,   -1,   -1,   36,
-  257,  270,  271,   40,   41,   -1,   -1,  264,   -1,   -1,
-   -1,   -1,   -1,  270,  271,   96,  123,   -1,   -1,   -1,
-  257,   -1,   36,   -1,   -1,  257,   40,   -1,   -1,   -1,
-   -1,   -1,  264,  270,  271,   -1,   -1,   96,  270,  257,
-   -1,   -1,  123,   -1,   -1,   -1,  264,   -1,   -1,   -1,
-   -1,   -1,  270,   -1,   -1,  257,   36,   -1,   -1,   96,
-   40,   -1,  264,   -1,  257,   -1,   -1,   -1,  270,   -1,
-   -1,  264,   -1,   -1,   -1,   -1,   -1,  270,   -1,   36,
-   -1,  257,   96,   40,   -1,   -1,   -1,   -1,  264,  257,
-   -1,   -1,   -1,   -1,  270,   -1,  264,   -1,   -1,   -1,
-   -1,   -1,  270,  258,  259,  260,  261,  262,  263,  123,
-  265,  266,  267,  268,  269,   -1,   96,  272,  273,   -1,
-  275,  276,  277,  278,  279,   -1,  258,  259,  260,  261,
-   -1,  263,   -1,  265,  266,  267,  268,  269,   -1,   96,
-  272,   -1,   -1,  275,  276,  277,  278,  279,   -1,  256,
-   -1,  258,  259,   -1,  261,  262,   -1,   -1,  265,  266,
-  267,  268,   -1,   -1,   -1,  272,  273,   -1,  275,  276,
-  277,  278,  279,   -1,   -1,   -1,   -1,  258,  259,  260,
-  261,   -1,  263,   -1,  265,  266,  267,  268,  269,   36,
-   -1,  272,   -1,   40,  275,  276,  277,  278,  279,  258,
-  259,  260,  261,   -1,  263,   -1,  265,  266,  267,  268,
-  269,   -1,   -1,  272,   -1,   -1,  275,  276,  277,  278,
-  279,  258,  259,  260,  261,   -1,  263,   -1,  265,  266,
-  267,  268,  269,   -1,   -1,  272,   -1,   -1,  275,  276,
-  277,  278,  279,   -1,  258,  259,  260,  261,  262,   96,
-   -1,  265,  266,  267,  268,   -1,   -1,   -1,  272,  273,
-   -1,  275,  276,  277,  278,  279,   -1,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,  123,   -1,  258,  259,
-  260,  261,   -1,  263,   -1,  265,  266,  267,  268,  269,
-   -1,   -1,  272,   -1,   -1,  275,  276,  277,  278,  279,
-   -1,  258,  259,  260,  261,   -1,  263,   -1,  265,  266,
-  267,  268,  269,   -1,   -1,  272,   -1,   -1,  275,  276,
-  277,  278,  279,   -1,   -1,   -1,    0,   -1,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,
-   -1,   -1,   -1,   -1,   18,   -1,   -1,   -1,   22,   -1,
-   -1,   25,   -1,   -1,   -1,   29,   -1,   -1,   -1,   -1,
-   22,   -1,   -1,   25,   -1,   -1,   -1,   29,   -1,   -1,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   51,   -1,   -1,
-   -1,   -1,   56,   -1,   -1,   -1,   -1,   61,   -1,   51,
-   -1,   -1,   -1,   -1,   -1,   69,   -1,   -1,   -1,   61,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-   -1,  258,  259,   -1,  261,  262,   -1,   -1,  265,  266,
-  267,  268,   -1,   97,   -1,  272,  273,  101,  275,  276,
-  277,  278,  279,   -1,   -1,   97,  110,  111,  112,  101,
-   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  110,  111,
-  112,   -1,   -1,   -1,   -1,   -1,   -1,  131,   -1,   -1,
-   -1,   -1,   -1,  137,  138,  139,   -1,   -1,  142,  131,
-   -1,  145,   -1,   -1,   -1,  137,  138,  139,   -1,   -1,
-  142,   -1,   -1,  145,
-};
-#define YYFINAL 21
-#ifndef YYDEBUG
-#define YYDEBUG 0
-#endif
-#define YYMAXTOKEN 280
-#if YYDEBUG
-const char * const yyname[] = {
-"end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,"'$'",0,"'&'",0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,
-"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'^'",0,
-"'`'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,"ANDAND","BACKBACK","BANG","CASE","COUNT","DUP","ELSE","END",
-"FLAT","FN","FOR","IF","IN","OROR","PIPE","REDIR","SREDIR","SUB","SUBSHELL",
-"SWITCH","TWIDDLE","WHILE","WORD","HUH",
-};
-const char * const yyrule[] = {
-"$accept : rc",
-"rc : line end",
-"rc : error end",
-"end : END",
-"end : '\\n'",
-"cmdsa : cmd ';'",
-"cmdsa : cmd '&'",
-"line : cmd",
-"line : cmdsa line",
-"body : cmd",
-"body : cmdsan body",
-"cmdsan : cmdsa",
-"cmdsan : cmd '\\n'",
-"brace : '{' body '}'",
-"paren : '(' body ')'",
-"assign : first '=' word",
-"epilog :",
-"epilog : redir epilog",
-"redir : DUP",
-"redir : REDIR word",
-"redir : SREDIR word",
-"case : CASE words ';'",
-"case : CASE words '\\n'",
-"cbody : cmd",
-"cbody : case cbody",
-"cbody : cmdsan cbody",
-"iftail : cmd",
-"iftail : brace ELSE optnl cmd",
-"cmd :",
-"cmd : simple",
-"cmd : brace epilog",
-"cmd : IF paren optnl iftail",
-"cmd : FOR '(' word IN words ')' optnl cmd",
-"cmd : FOR '(' word ')' optnl cmd",
-"cmd : WHILE paren optnl cmd",
-"cmd : SWITCH '(' word ')' optnl '{' cbody '}'",
-"cmd : TWIDDLE optcaret word words",
-"cmd : cmd ANDAND optnl cmd",
-"cmd : cmd OROR optnl cmd",
-"cmd : cmd PIPE optnl cmd",
-"cmd : redir cmd",
-"cmd : assign cmd",
-"cmd : BANG optcaret cmd",
-"cmd : SUBSHELL optcaret cmd",
-"cmd : FN words brace",
-"cmd : FN words",
-"optcaret :",
-"optcaret : '^'",
-"simple : first",
-"simple : simple word",
-"simple : simple redir",
-"first : comword",
-"first : first '^' sword",
-"sword : comword",
-"sword : keyword",
-"word : sword",
-"word : word '^' sword",
-"comword : '$' sword",
-"comword : '$' sword SUB words ')'",
-"comword : COUNT sword",
-"comword : FLAT sword",
-"comword : '`' sword",
-"comword : '`' brace",
-"comword : BACKBACK word brace",
-"comword : BACKBACK word sword",
-"comword : '(' nlwords ')'",
-"comword : REDIR brace",
-"comword : WORD",
-"keyword : FOR",
-"keyword : IN",
-"keyword : WHILE",
-"keyword : IF",
-"keyword : SWITCH",
-"keyword : FN",
-"keyword : ELSE",
-"keyword : CASE",
-"keyword : TWIDDLE",
-"keyword : BANG",
-"keyword : SUBSHELL",
-"words :",
-"words : words word",
-"nlwords :",
-"nlwords : nlwords '\\n'",
-"nlwords : nlwords word",
-"optnl :",
-"optnl : optnl '\\n'",
-};
-#endif
-#if YYDEBUG
-#include <stdio.h>
-#endif
-#ifdef YYSTACKSIZE
-#undef YYMAXDEPTH
-#define YYMAXDEPTH YYSTACKSIZE
-#else
-#ifdef YYMAXDEPTH
-#define YYSTACKSIZE YYMAXDEPTH
-#else
-#define YYSTACKSIZE 10000
-#define YYMAXDEPTH 10000
-#endif
-#endif
-#define YYINITSTACKSIZE 200
-int yydebug;
-int yynerrs;
-int yyerrflag;
-int yychar;
-short *yyssp;
-YYSTYPE *yyvsp;
-YYSTYPE yyval;
-YYSTYPE yylval;
-short *yyss;
-short *yysslim;
-YYSTYPE *yyvs;
-int yystacksize;
-#line 167 "parse.y"
-
-void initparse() {
-       star = treecpy(mk(nVar, mk(nWord,"*", NULL, FALSE)), ealloc);
-       nolist = treecpy(mk(nVar, mk(nWord,"ifs", NULL, FALSE)), ealloc);
-}
-
-#line 583 "y.tab.c"
-/* allocate initial stack or double stack size, up to YYMAXDEPTH */
-static int yygrowstack()
-{
-    int newsize, i;
-    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 ? (short *)realloc(yyss, newsize * sizeof *newss) :
-      (short *)malloc(newsize * sizeof *newss);
-    if (newss == NULL)
-        return -1;
-    yyss = newss;
-    yyssp = newss + i;
-    newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
-      (YYSTYPE *)malloc(newsize * sizeof *newvs);
-    if (newvs == NULL)
-        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
-
-#ifndef YYPARSE_PARAM
-#if defined(__cplusplus) || __STDC__
-#define YYPARSE_PARAM_ARG void
-#define YYPARSE_PARAM_DECL
-#else  /* ! ANSI-C/C++ */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* ANSI-C/C++ */
-#else  /* YYPARSE_PARAM */
-#ifndef YYPARSE_PARAM_TYPE
-#define YYPARSE_PARAM_TYPE void *
-#endif
-#if defined(__cplusplus) || __STDC__
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else  /* ! ANSI-C/C++ */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
-#endif /* ANSI-C/C++ */
-#endif /* ! YYPARSE_PARAM */
-
-int
-yyparse (YYPARSE_PARAM_ARG)
-    YYPARSE_PARAM_DECL
-{
-    register int yym, yyn, yystate;
-#if YYDEBUG
-    register const char *yys;
-
-    if ((yys = getenv("YYDEBUG")))
-    {
-        yyn = *yys;
-        if (yyn >= '0' && yyn <= '9')
-            yydebug = yyn - '0';
-    }
-#endif
-
-    yynerrs = 0;
-    yyerrflag = 0;
-    yychar = (-1);
-
-    if (yyss == NULL && yygrowstack()) goto yyoverflow;
-    yyssp = yyss;
-    yyvsp = yyvs;
-    *yyssp = yystate = 0;
-
-yyloop:
-    if ((yyn = yydefred[yystate])) goto yyreduce;
-    if (yychar < 0)
-    {
-        if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
-        if (yydebug)
-        {
-            yys = 0;
-            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
-            if (!yys) yys = "illegal-symbol";
-            printf("%sdebug: state %d, reading %d (%s)\n",
-                    YYPREFIX, yystate, yychar, yys);
-        }
-#endif
-    }
-    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
-            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
-    {
-#if YYDEBUG
-        if (yydebug)
-            printf("%sdebug: state %d, shifting to state %d\n",
-                    YYPREFIX, yystate, yytable[yyn]);
-#endif
-        if (yyssp >= yysslim && yygrowstack())
-        {
-            goto yyoverflow;
-        }
-        *++yyssp = yystate = yytable[yyn];
-        *++yyvsp = yylval;
-        yychar = (-1);
-        if (yyerrflag > 0)  --yyerrflag;
-        goto yyloop;
-    }
-    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
-            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
-    {
-        yyn = yytable[yyn];
-        goto yyreduce;
-    }
-    if (yyerrflag) goto yyinrecovery;
-#if defined(lint) || defined(__GNUC__)
-    goto yynewerror;
-#endif
-yynewerror:
-    yyerror("syntax error");
-#if defined(lint) || defined(__GNUC__)
-    goto yyerrlab;
-#endif
-yyerrlab:
-    ++yynerrs;
-yyinrecovery:
-    if (yyerrflag < 3)
-    {
-        yyerrflag = 3;
-        for (;;)
-        {
-            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
-                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
-            {
-#if YYDEBUG
-                if (yydebug)
-                    printf("%sdebug: state %d, error recovery shifting\
- to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
-#endif
-                if (yyssp >= yysslim && yygrowstack())
-                {
-                    goto yyoverflow;
-                }
-                *++yyssp = yystate = yytable[yyn];
-                *++yyvsp = yylval;
-                goto yyloop;
-            }
-            else
-            {
-#if YYDEBUG
-                if (yydebug)
-                    printf("%sdebug: error recovery discarding state %d\n",
-                            YYPREFIX, *yyssp);
-#endif
-                if (yyssp <= yyss) goto yyabort;
-                --yyssp;
-                --yyvsp;
-            }
-        }
-    }
-    else
-    {
-        if (yychar == 0) goto yyabort;
-#if YYDEBUG
-        if (yydebug)
-        {
-            yys = 0;
-            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
-            if (!yys) yys = "illegal-symbol";
-            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
-                    YYPREFIX, yystate, yychar, yys);
-        }
-#endif
-        yychar = (-1);
-        goto yyloop;
-    }
-yyreduce:
-#if YYDEBUG
-    if (yydebug)
-        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
-                YYPREFIX, yystate, yyn, yyrule[yyn]);
-#endif
-    yym = yylen[yyn];
-    yyval = yyvsp[1-yym];
-    switch (yyn)
-    {
-case 1:
-#line 47 "parse.y"
-{ parsetree = yyvsp[-1].node; YYACCEPT; }
-break;
-case 2:
-#line 48 "parse.y"
-{ yyerrok; parsetree = NULL; YYABORT; }
-break;
-case 3:
-#line 51 "parse.y"
-{ if (!heredoc(1)) YYABORT; }
-break;
-case 4:
-#line 52 "parse.y"
-{ if (!heredoc(0)) YYABORT; }
-break;
-case 6:
-#line 56 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? mk(nNowait,yyvsp[-1].node) : yyvsp[-1].node); }
-break;
-case 8:
-#line 60 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? mk(nBody,yyvsp[-1].node,yyvsp[0].node) : yyvsp[0].node); }
-break;
-case 10:
-#line 64 "parse.y"
-{ yyval.node = (yyvsp[-1].node == NULL ? yyvsp[0].node : yyvsp[0].node == NULL ? yyvsp[-1].node : mk(nBody,yyvsp[-1].node,yyvsp[0].node)); }
-break;
-case 12:
-#line 67 "parse.y"
-{ yyval.node = yyvsp[-1].node; if (!heredoc(0)) YYABORT; }
-break;
-case 13:
-#line 69 "parse.y"
-{ yyval.node = yyvsp[-1].node; }
-break;
-case 14:
-#line 71 "parse.y"
-{ yyval.node = yyvsp[-1].node; }
-break;
-case 15:
-#line 73 "parse.y"
-{ yyval.node = mk(nAssign,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 16:
-#line 75 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 17:
-#line 76 "parse.y"
-{ yyval.node = mk(nEpilog,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 18:
-#line 79 "parse.y"
-{ yyval.node = mk(nDup,yyvsp[0].dup.type,yyvsp[0].dup.left,yyvsp[0].dup.right); }
-break;
-case 19:
-#line 80 "parse.y"
-{ yyval.node = mk(nRedir,yyvsp[-1].redir.type,yyvsp[-1].redir.fd,yyvsp[0].node);
-                                 if (yyvsp[-1].redir.type == rHeredoc && !qdoc(yyvsp[0].node, yyval.node)) YYABORT; /* queue heredocs up */
-                               }
-break;
-case 20:
-#line 83 "parse.y"
-{ yyval.node = mk(nRedir,yyvsp[-1].redir.type,yyvsp[-1].redir.fd,yyvsp[0].node);
-                                 if (yyvsp[-1].redir.type == rHeredoc && !qdoc(yyvsp[0].node, yyval.node)) YYABORT; /* queue heredocs up */
-                               }
-break;
-case 21:
-#line 87 "parse.y"
-{ yyval.node = mk(nCase, yyvsp[-1].node); }
-break;
-case 22:
-#line 88 "parse.y"
-{ yyval.node = mk(nCase, yyvsp[-1].node); }
-break;
-case 23:
-#line 90 "parse.y"
-{ yyval.node = mk(nCbody, yyvsp[0].node, NULL); }
-break;
-case 24:
-#line 91 "parse.y"
-{ yyval.node = mk(nCbody, yyvsp[-1].node, yyvsp[0].node); }
-break;
-case 25:
-#line 92 "parse.y"
-{ yyval.node = mk(nCbody, yyvsp[-1].node, yyvsp[0].node); }
-break;
-case 27:
-#line 95 "parse.y"
-{ yyval.node = mk(nElse,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 28:
-#line 97 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 30:
-#line 99 "parse.y"
-{ yyval.node = mk(nBrace,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 31:
-#line 100 "parse.y"
-{ yyval.node = mk(nIf,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 32:
-#line 101 "parse.y"
-{ yyval.node = mk(nForin,yyvsp[-5].node,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 33:
-#line 102 "parse.y"
-{ yyval.node = mk(nForin,yyvsp[-3].node,star,yyvsp[0].node); }
-break;
-case 34:
-#line 103 "parse.y"
-{ yyval.node = mk(nWhile,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 35:
-#line 104 "parse.y"
-{ yyval.node = mk(nSwitch,yyvsp[-5].node,yyvsp[-1].node); }
-break;
-case 36:
-#line 105 "parse.y"
-{ yyval.node = mk(nMatch,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 37:
-#line 106 "parse.y"
-{ yyval.node = mk(nAndalso,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 38:
-#line 107 "parse.y"
-{ yyval.node = mk(nOrelse,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 39:
-#line 108 "parse.y"
-{ yyval.node = mk(nPipe,yyvsp[-2].pipe.left,yyvsp[-2].pipe.right,yyvsp[-3].node,yyvsp[0].node); }
-break;
-case 40:
-#line 109 "parse.y"
-{ yyval.node = (yyvsp[0].node != NULL ? mk(nPre,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node); }
-break;
-case 41:
-#line 110 "parse.y"
-{ yyval.node = (yyvsp[0].node != NULL ? mk(nPre,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node); }
-break;
-case 42:
-#line 111 "parse.y"
-{ yyval.node = mk(nBang,yyvsp[0].node); }
-break;
-case 43:
-#line 112 "parse.y"
-{ yyval.node = mk(nSubshell,yyvsp[0].node); }
-break;
-case 44:
-#line 113 "parse.y"
-{ yyval.node = mk(nNewfn,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 45:
-#line 114 "parse.y"
-{ yyval.node = mk(nRmfn,yyvsp[0].node); }
-break;
-case 49:
-#line 120 "parse.y"
-{ yyval.node = (yyvsp[0].node != NULL ? mk(nArgs,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node); }
-break;
-case 50:
-#line 121 "parse.y"
-{ yyval.node = mk(nArgs,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 52:
-#line 124 "parse.y"
-{ yyval.node = mk(nConcat,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 54:
-#line 127 "parse.y"
-{ yyval.node = mk(nWord, yyvsp[0].keyword, NULL, FALSE); }
-break;
-case 56:
-#line 130 "parse.y"
-{ yyval.node = mk(nConcat,yyvsp[-2].node,yyvsp[0].node); }
-break;
-case 57:
-#line 132 "parse.y"
-{ yyval.node = mk(nVar,yyvsp[0].node); }
-break;
-case 58:
-#line 133 "parse.y"
-{ yyval.node = mk(nVarsub,yyvsp[-3].node,yyvsp[-1].node); }
-break;
-case 59:
-#line 134 "parse.y"
-{ yyval.node = mk(nCount,yyvsp[0].node); }
-break;
-case 60:
-#line 135 "parse.y"
-{ yyval.node = mk(nFlat, yyvsp[0].node); }
-break;
-case 61:
-#line 136 "parse.y"
-{ yyval.node = mk(nBackq,nolist,yyvsp[0].node); }
-break;
-case 62:
-#line 137 "parse.y"
-{ yyval.node = mk(nBackq,nolist,yyvsp[0].node); }
-break;
-case 63:
-#line 138 "parse.y"
-{ yyval.node = mk(nBackq,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 64:
-#line 139 "parse.y"
-{ yyval.node = mk(nBackq,yyvsp[-1].node,yyvsp[0].node); }
-break;
-case 65:
-#line 140 "parse.y"
-{ yyval.node = yyvsp[-1].node; }
-break;
-case 66:
-#line 141 "parse.y"
-{ yyval.node = mk(nNmpipe,yyvsp[-1].redir.type,yyvsp[-1].redir.fd,yyvsp[0].node); }
-break;
-case 67:
-#line 142 "parse.y"
-{ yyval.node = mk(nWord, yyvsp[0].word.w, yyvsp[0].word.m, yyvsp[0].word.q); }
-break;
-case 68:
-#line 144 "parse.y"
-{ yyval.keyword = "for"; }
-break;
-case 69:
-#line 145 "parse.y"
-{ yyval.keyword = "in"; }
-break;
-case 70:
-#line 146 "parse.y"
-{ yyval.keyword = "while"; }
-break;
-case 71:
-#line 147 "parse.y"
-{ yyval.keyword = "if"; }
-break;
-case 72:
-#line 148 "parse.y"
-{ yyval.keyword = "switch"; }
-break;
-case 73:
-#line 149 "parse.y"
-{ yyval.keyword = "fn"; }
-break;
-case 74:
-#line 150 "parse.y"
-{ yyval.keyword = "else"; }
-break;
-case 75:
-#line 151 "parse.y"
-{ yyval.keyword = "case"; }
-break;
-case 76:
-#line 152 "parse.y"
-{ yyval.keyword = "~"; }
-break;
-case 77:
-#line 153 "parse.y"
-{ yyval.keyword = "!"; }
-break;
-case 78:
-#line 154 "parse.y"
-{ yyval.keyword = "@"; }
-break;
-case 79:
-#line 156 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 80:
-#line 157 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? (yyvsp[0].node != NULL ? mk(nLappend,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node) : yyvsp[0].node); }
-break;
-case 81:
-#line 159 "parse.y"
-{ yyval.node = NULL; }
-break;
-case 83:
-#line 161 "parse.y"
-{ yyval.node = (yyvsp[-1].node != NULL ? (yyvsp[0].node != NULL ? mk(nLappend,yyvsp[-1].node,yyvsp[0].node) : yyvsp[-1].node) : yyvsp[0].node); }
-break;
-#line 1062 "y.tab.c"
-    }
-    yyssp -= yym;
-    yystate = *yyssp;
-    yyvsp -= yym;
-    yym = yylhs[yyn];
-    if (yystate == 0 && yym == 0)
-    {
-#if YYDEBUG
-        if (yydebug)
-            printf("%sdebug: after reduction, shifting from state 0 to\
- state %d\n", YYPREFIX, YYFINAL);
-#endif
-        yystate = YYFINAL;
-        *++yyssp = YYFINAL;
-        *++yyvsp = yyval;
-        if (yychar < 0)
-        {
-            if ((yychar = yylex()) < 0) yychar = 0;
-#if YYDEBUG
-            if (yydebug)
-            {
-                yys = 0;
-                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
-                if (!yys) yys = "illegal-symbol";
-                printf("%sdebug: state %d, reading %d (%s)\n",
-                        YYPREFIX, YYFINAL, yychar, yys);
-            }
-#endif
-        }
-        if (yychar == 0) goto yyaccept;
-        goto yyloop;
-    }
-    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
-            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
-        yystate = yytable[yyn];
-    else
-        yystate = yydgoto[yym];
-#if YYDEBUG
-    if (yydebug)
-        printf("%sdebug: after reduction, shifting from state %d \
-to state %d\n", YYPREFIX, *yyssp, yystate);
-#endif
-    if (yyssp >= yysslim && yygrowstack())
-    {
-        goto yyoverflow;
-    }
-    *++yyssp = yystate;
-    *++yyvsp = yyval;
-    goto yyloop;
-yyoverflow:
-    yyerror("yacc stack overflow");
-yyabort:
-    return (1);
-yyaccept:
-    return (0);
-}
diff --git a/parse.h b/parse.h
deleted file mode 100644 (file)
index c193710..0000000
--- a/parse.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef YYERRCODE
-#define YYERRCODE 256
-#endif
-
-#define ANDAND 257
-#define BACKBACK 258
-#define BANG 259
-#define CASE 260
-#define COUNT 261
-#define DUP 262
-#define ELSE 263
-#define END 264
-#define FLAT 265
-#define FN 266
-#define FOR 267
-#define IF 268
-#define IN 269
-#define OROR 270
-#define PIPE 271
-#define REDIR 272
-#define SREDIR 273
-#define SUB 274
-#define SUBSHELL 275
-#define SWITCH 276
-#define TWIDDLE 277
-#define WHILE 278
-#define WORD 279
-#define HUH 280
-typedef union {
-       struct Node *node;
-       struct Redir redir;
-       struct Pipe pipe;
-       struct Dup dup;
-       struct Word word;
-       char *keyword;
-} YYSTYPE;
-extern YYSTYPE yylval;
diff --git a/print.c b/print.c
index 6309e876a238907a8155f7f76d10daf12767c310..6ab045510ff0c7c9a53237e2002dc7b845d29ca7 100644 (file)
--- a/print.c
+++ b/print.c
@@ -1,7 +1,6 @@
 /* print.c -- formatted printing routines (Paul Haahr, 12/91) */
 
 #include "rc.h"
-#include <setjmp.h>
 
 #define        PRINT_ALLOCSIZE ((size_t)64)
 #define        SPRINT_BUFSIZ   ((size_t)1024)
diff --git a/rc.h b/rc.h
index 39e5560dac9b009bc59bcf457ea3893a013d48ec..a3f3f229ade43d89469a91921f327b1893352753 100644 (file)
--- a/rc.h
+++ b/rc.h
@@ -1,30 +1,34 @@
 #undef NDEBUG
+#define _XOPEN_SOURCE 700
 
 #include "config.h"
 
+/* C standard includes */
 #include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 #include <stdbool.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
 #include <assert.h>
-#include <sys/types.h>
 #include <signal.h>
-#include <stdarg.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <ctype.h>
+
+/* POSIX includes */
+#include <unistd.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-#include <limits.h>
-#include <setjmp.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
 
 typedef long align_t;
 
-/* C 99 specifies a va_copy() macro to be used for copying
-objects of type va_list. If this doesn't exist, hope that simple
-assignment works. */
-#ifndef va_copy
-#define va_copy(x,y) (x)=(y)
-#endif
-
 #define TRUE  true
 #define FALSE false
 
@@ -35,17 +39,6 @@ assignment works. */
 /* These don't exist in POSIX. */
 #define myWIFDUMPED(s) (((s) & 0x80) != 0)
 
-/*
-    edit.h
-*/
-extern bool editing;
-extern void *edit_begin(int fd);
-extern char *edit_alloc(void *, size_t *);
-extern void edit_free(void *);
-extern void edit_prompt(void *, char *);
-extern void edit_end(void *);
-extern void edit_reset(void *);
-
 /*
     jbwrap.h
 */
@@ -88,11 +81,14 @@ struct Limit {
        const struct Suffix *suffix;
 };
 
-
+#ifdef __DARWIN_NSIG 
+       #define NSIG __DARWIN_NSIG
+#endif
 
 typedef struct {
        char *name, *msg;
 } Sigmsgs;
+
 extern Sigmsgs signals[NSIG];
 
 #define RC "rc: "
index d7d32190b6bd84db18af1649f8b6dda8427bf969..c769a4e16ae390b0b84dee8677b3b7d941abd0e6 100644 (file)
--- a/sigmsgs.c
+++ b/sigmsgs.c
 #include "rc.h"
 
 Sigmsgs signals[NSIG] = {
+#ifdef SIGHUP
     [SIGHUP]    = { "sighup",    "hangup" },
+#endif
+#ifdef SIGINT
     [SIGINT]    = { "sigint",    "" },
+#endif
+#ifdef SIGQUIT
     [SIGQUIT]   = { "sigquit",   "quit" },
+#endif
+#ifdef SIGILL
     [SIGILL]    = { "sigill",    "illegal instruction" },
+#endif
+#ifdef SIGTRAP
     [SIGTRAP]   = { "sigtrap",   "trace trap" },
+#endif
+#ifdef SIGABRT
     [SIGABRT]   = { "sigabrt",   "abort" },
-    [SIGIOT]    = { "sigiot",    "iot trap " },
+#endif
+#ifdef SIGBUS
     [SIGBUS]    = { "sigbus",    "bus error" },
+#endif
+#ifdef SIGFPE
     [SIGFPE]    = { "sigfpe",    "floating-point exception" },
+#endif
+#ifdef SIGKILL
     [SIGKILL]   = { "sigkill",   "kill, unblockable" },
+#endif
+#ifdef SIGUSR1
     [SIGUSR1]   = { "sigusr1",   "user-defined signal 1" },
+#endif
+#ifdef SIGSEGV
     [SIGSEGV]   = { "sigsegv",   "segmentation violation" },
+#endif
+#ifdef SIGUSR2
     [SIGUSR2]   = { "sigusr2",   "user-defined signal 2" },
+#endif
+#ifdef SIGPIPE
     [SIGPIPE]   = { "sigpipe",   "broken pipe" },
+#endif
+#ifdef SIGALRM
     [SIGALRM]   = { "sigalrm",   "alarm clock" },
+#endif
+#ifdef SIGTERM
     [SIGTERM]   = { "sigterm",   "termination" },
+#endif
+#ifdef SIGSTKFLT
     [SIGSTKFLT] = { "sigstkflt", "stack fault" },
+#endif
+#ifdef SIGCLD
     [SIGCLD]    = { "sigcld",    "child stop or exit" },
+#endif
+#ifdef SIGCHLD
     [SIGCHLD]   = { "sigchld",   "child status has changed" },
+#endif
+#ifdef SIGCONT
     [SIGCONT]   = { "sigcont",   "continue" },
+#endif
+#ifdef SIGSTOP
     [SIGSTOP]   = { "sigstop",   "stop, unblockable" },
+#endif
+#ifdef SIGTSTP
     [SIGTSTP]   = { "sigstp",    "keyboard stop" },
+#endif
+#ifdef SIGTTIN
     [SIGTTIN]   = { "sigttin",   "background read from tty" },
+#endif
+#ifdef SIGTTOU
     [SIGTTOU]   = { "sigttou",   "background write to tty" },
+#endif
+#ifdef SIGURG
     [SIGURG]    = { "sigurg",    "urgent condition on socket" },
+#endif
+#ifdef SIGXCPU
     [SIGXCPU]   = { "sigxcpu",   "cpu limit exceeded" },
+#endif
+#ifdef SIGXFSZ
     [SIGXFSZ]   = { "sigxfsz",   "file size limit exceeded" },
+#endif
+#ifdef SIGVTALRM
     [SIGVTALRM] = { "sigvtalrm", "virtual alarm clock" },
+#endif
+#ifdef SIGPROF
     [SIGPROF]   = { "sigprof",   "profiling alarm clock" },
+#endif
+#ifdef SIGWINCH
     [SIGWINCH]  = { "sigwinch",  "window size change" },
+#endif
+#ifdef SIGPOLL
     [SIGPOLL]   = { "sigpoll",   "pollable event occurred" },
+#endif
+#ifdef SIGIO
     [SIGIO]     = { "sigio",     "i/o now possible" },
+#endif
+#ifdef SIGPWR
     [SIGPWR]    = { "sigpwr",    "power failure restart" },
+#endif
+#ifdef SIGSYS
     [SIGSYS]    = { "sigsys",    "bad system call" },
+#endif
 };
index bae465b8800e2265424ac96ca64acc837d842f88..7131ae632bb1030e5355b7804d396384dcf38316 100644 (file)
--- a/signal.c
+++ b/signal.c
@@ -2,9 +2,6 @@
 
 #include "rc.h"
 
-#include <signal.h>
-#include <setjmp.h>
-
 void (*sys_signal(int signum, void (*handler)(int)))(int) {
        struct sigaction new, old;
 
diff --git a/utils.c b/utils.c
index 1639628105d9bd32d50be69cd9359127fb3f20da..3747520e55c9e8d1de70f54bc390c0a85a04fed0 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -2,9 +2,6 @@
 
 #include "rc.h"
 
-#include <errno.h>
-#include <setjmp.h>
-
 /* print error with line number on noninteractive shells (i.e., scripts) */
 
 extern void pr_error(char *s, int offset) {
diff --git a/var.c b/var.c
index 002e4d8a2baa583a482b099765c9010a25a423a8..2881d5870dd85c24fff643a0aeef099bd7aed6dd 100644 (file)
--- a/var.c
+++ b/var.c
@@ -19,8 +19,6 @@ extern void varassign(char *name, List *def, bool stack) {
        new->def = newdef;
        new->extdef = NULL;
        set_exportable(name, TRUE);
-       if (streq(name, "TERM") || streq(name, "TERMCAP"))
-               termchange();
 }
 
 /* assign a variable in string form. Check to see if it is aliased (e.g., PATH and path) */
diff --git a/wait.c b/wait.c
index 258ba686ea4ddf9a51423f646ec6d5cea36549c3..06d6271b1a5df6f68f07e3dd3cd84f6fd8c7d23f 100644 (file)
--- a/wait.c
+++ b/wait.c
@@ -1,7 +1,5 @@
 #include "rc.h"
 
-#include <errno.h>
-
 bool forked = FALSE;
 
 typedef struct Pid Pid;
diff --git a/walk.c b/walk.c
index 3c9b1bbe734c91ee3103d5c7c2a670e5b0a999f8..f1de169d19b71ae50ede7ca238e5ab6d341211c7 100644 (file)
--- a/walk.c
+++ b/walk.c
@@ -2,9 +2,6 @@
 
 #include "rc.h"
 
-#include <signal.h>
-#include <setjmp.h>
-
 /*
    global which indicates whether rc is executing a test;
    used by rc -e so that if (false) does not exit.
diff --git a/which.c b/which.c
index 3fc3f1ab639c9e7149872a2dd55bd206890654f6..b67e8dc2867d46a4017e24c46399dc1ac3db24ed 100644 (file)
--- a/which.c
+++ b/which.c
 
 #include "rc.h"
 
-#include <ctype.h>
-#include <errno.h>
-#include <sys/stat.h>
-
 #define X_USR 0100
 #define X_GRP 0010
 #define X_OTH 0001