ast@cs.vu.nl (Andy Tanenbaum) (01/23/89)
: This is a shar archive. Extract with sh, not csh. : This archive ends with exit, so do not worry about trailing junk. : --------------------------- cut here -------------------------- PATH=/bin:/usr/bin:/usr/ucb echo Extracting 'make:makefile.' sed 's/^X//' > 'make:makefile.' << '+ END-OF-FILE ''make:makefile.' X*** makefile Sun Jan 22 22:52:06 1989 X--- ../../../tape3/commands/make/makefile Mon Sep 26 13:02:53 1988 X*************** X*** 1,6 **** X # Makefile for make! X X! CFLAGS = -Dunix -DMINIXPC X X OBJS = check.s input.s macro.s main.s \ X make.s reader.s rules.s X--- 1,6 ---- X # Makefile for make! X X! CFLAGS = -Dunix -DMINIX X X OBJS = check.s input.s macro.s main.s \ X make.s reader.s rules.s + END-OF-FILE make:makefile. chmod 'u=rw,g=r,o=r' 'make:makefile.' set `wc -c 'make:makefile.'` count=$1 case $count in 399) :;; *) echo 'Bad character count in ''make:makefile.' >&2 echo 'Count should be 399' >&2 esac echo Extracting 'make:rules.cdi' sed 's/^X//' > 'make:rules.cdi' << '+ END-OF-FILE ''make:rules.cdi' X*** rules.c Sun Jan 22 22:52:07 1989 X--- ../../../tape3/commands/make/rules.c Mon Sep 26 13:02:54 1988 X*************** X*** 83,89 **** X modtime(op); X if (op->n_time) X { X! dp = newdep(op, (char *)0); X newline(np, dp, sp->n_line->l_cmd, 0); X setmacro("<", op->n_name); X return TRUE; X--- 83,89 ---- X modtime(op); X if (op->n_time) X { X! dp = newdep(op, 0); X newline(np, dp, sp->n_line->l_cmd, 0); X setmacro("<", op->n_name); X return TRUE; X*************** X*** 110,137 **** X /* setmacro("BDSCFLAGS", ""); */ X cp = newcmd("$(BDSCC) $(BDSCFLAGS) -n $<", 0); X np = newname(".c.o"); X! newline(np, (char *)0, cp, 0); X X setmacro("CC", "c"); X setmacro("CFLAGS", "-O"); X cp = newcmd("$(CC) $(CFLAGS) -c $<", 0); X np = newname(".c.obj"); X! newline(np, (char *)0, cp, 0); X X setmacro("M80", "asm -n"); X /* setmacro("M80FLAGS", ""); */ X cp = newcmd("$(M80) $(M80FLAGS) $<", 0); X np = newname(".mac.o"); X! newline(np, (char *)0, cp, 0); X X setmacro("AS", "zas"); X /* setmacro("ASFLAGS", ""); */ X cp = newcmd("$(ZAS) $(ASFLAGS) -o $@ $<", 0); X np = newname(".as.obj"); X! newline(np, (char *)0, cp, 0); X X np = newname(".as"); X! dp = newdep(np, (char *)0); X np = newname(".obj"); X dp = newdep(np, dp); X np = newname(".c"); X--- 110,137 ---- X /* setmacro("BDSCFLAGS", ""); */ X cp = newcmd("$(BDSCC) $(BDSCFLAGS) -n $<", 0); X np = newname(".c.o"); X! newline(np, 0, cp, 0); X X setmacro("CC", "c"); X setmacro("CFLAGS", "-O"); X cp = newcmd("$(CC) $(CFLAGS) -c $<", 0); X np = newname(".c.obj"); X! newline(np, 0, cp, 0); X X setmacro("M80", "asm -n"); X /* setmacro("M80FLAGS", ""); */ X cp = newcmd("$(M80) $(M80FLAGS) $<", 0); X np = newname(".mac.o"); X! newline(np, 0, cp, 0); X X setmacro("AS", "zas"); X /* setmacro("ASFLAGS", ""); */ X cp = newcmd("$(ZAS) $(ASFLAGS) -o $@ $<", 0); X np = newname(".as.obj"); X! newline(np, 0, cp, 0); X X np = newname(".as"); X! dp = newdep(np, 0); X np = newname(".obj"); X dp = newdep(np, dp); X np = newname(".c"); X*************** X*** 141,147 **** X np = newname(".mac"); X dp = newdep(np, dp); X np = newname(".SUFFIXES"); X! newline(np, dp, (char *)0, 0); X #endif X X /* X--- 141,147 ---- X np = newname(".mac"); X dp = newdep(np, dp); X np = newname(".SUFFIXES"); X! newline(np, dp, 0, 0); X #endif X X /* X*************** X*** 150,185 **** X #ifdef unix X setmacro("CC", "cc"); X setmacro("CFLAGS", "-O"); X! #ifdef MINIXPC X! cp = newcmd("$(CC) $(CFLAGS) -S $<", (char *)0); X np = newname(".c.s"); X #else X! cp = newcmd("$(CC) $(CFLAGS) -c $<", (char *)0); X np = newname(".c.o"); X! #endif MINIXPC X! newline(np, (char *)0, cp, 0); X X setmacro("AS", "as"); X! cp = newcmd("$(AS) -o $@ $<", (char *)0); X np = newname(".s.o"); X! newline(np, (char *)0, cp, 0); X X setmacro("YACC", "yacc"); X /* setmacro("YFLAGS", ""); */ X! cp = newcmd("$(YACC) $(YFLAGS) $<", (char *)0); X cp = newcmd("mv y.tab.c $@", cp); X np = newname(".y.c"); X! newline(np, (char *)0, cp, 0); X X! cp = newcmd("$(YACC) $(YFLAGS) $<", (char *)0); X cp = newcmd("$(CC) $(CFLAGS) -c y.tab.c", cp); X cp = newcmd("rm y.tab.c", cp); X cp = newcmd("mv y.tab.o $@", cp); X np = newname(".y.o"); X! newline(np, (char *)0, cp, 0); X X np = newname(".s"); X! dp = newdep(np, (char *)0); X np = newname(".o"); X dp = newdep(np, dp); X np = newname(".c"); X--- 150,185 ---- X #ifdef unix X setmacro("CC", "cc"); X setmacro("CFLAGS", "-O"); X! #ifdef MINIX X! cp = newcmd("$(CC) $(CFLAGS) -S $<", 0); X np = newname(".c.s"); X #else X! cp = newcmd("$(CC) $(CFLAGS) -c $<", 0); X np = newname(".c.o"); X! #endif MINIX X! newline(np, 0, cp, 0); X X setmacro("AS", "as"); X! cp = newcmd("$(AS) -o $@ $<", 0); X np = newname(".s.o"); X! newline(np, 0, cp, 0); X X setmacro("YACC", "yacc"); X /* setmacro("YFLAGS", ""); */ X! cp = newcmd("$(YACC) $(YFLAGS) $<", 0); X cp = newcmd("mv y.tab.c $@", cp); X np = newname(".y.c"); X! newline(np, 0, cp, 0); X X! cp = newcmd("$(YACC) $(YFLAGS) $<", 0); X cp = newcmd("$(CC) $(CFLAGS) -c y.tab.c", cp); X cp = newcmd("rm y.tab.c", cp); X cp = newcmd("mv y.tab.o $@", cp); X np = newname(".y.o"); X! newline(np, 0, cp, 0); X X np = newname(".s"); X! dp = newdep(np, 0); X np = newname(".o"); X dp = newdep(np, dp); X np = newname(".c"); X*************** X*** 187,193 **** X np = newname(".y"); X dp = newdep(np, dp); X np = newname(".SUFFIXES"); X! newline(np, dp, (char *)0, 0); X #endif X #ifdef os9 X /* X--- 187,193 ---- X np = newname(".y"); X dp = newdep(np, dp); X np = newname(".SUFFIXES"); X! newline(np, dp, 0, 0); X #endif X #ifdef os9 X /* X*************** X*** 199,222 **** X cp = newcmd("$(CC) $(CFLAGS) -r $<", 0); X X np = newname(".c.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".ca.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".a.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".o.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".mc.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".mca.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".ma.r"); X! newline(np, (char *)0, cp, 0); X np = newname(".mo.r"); X! newline(np, (char *)0, cp, 0); X X np = newname(".r"); X! dp = newdep(np, (char *)0); X np = newname(".mc"); X dp = newdep(np, dp); X np = newname(".mca"); X--- 199,222 ---- X cp = newcmd("$(CC) $(CFLAGS) -r $<", 0); X X np = newname(".c.r"); X! newline(np, 0, cp, 0); X np = newname(".ca.r"); X! newline(np, 0, cp, 0); X np = newname(".a.r"); X! newline(np, 0, cp, 0); X np = newname(".o.r"); X! newline(np, 0, cp, 0); X np = newname(".mc.r"); X! newline(np, 0, cp, 0); X np = newname(".mca.r"); X! newline(np, 0, cp, 0); X np = newname(".ma.r"); X! newline(np, 0, cp, 0); X np = newname(".mo.r"); X! newline(np, 0, cp, 0); X X np = newname(".r"); X! dp = newdep(np, 0); X np = newname(".mc"); X dp = newdep(np, dp); X np = newname(".mca"); X*************** X*** 234,239 **** X np = newname(".a"); X dp = newdep(np, dp); X np = newname(".SUFFIXES"); X! newline(np, dp, (char *)0, 0); X #endif X } X--- 234,239 ---- X np = newname(".a"); X dp = newdep(np, dp); X np = newname(".SUFFIXES"); X! newline(np, dp, 0, 0); X #endif X } + END-OF-FILE make:rules.cdi chmod 'u=rw,g=r,o=r' 'make:rules.cdi' set `wc -c 'make:rules.cdi'` count=$1 case $count in 6257) :;; *) echo 'Bad character count in ''make:rules.cdi' >&2 echo 'Count should be 6257' >&2 esac echo Extracting 'sh.h.cdif' sed 's/^X//' > 'sh.h.cdif' << '+ END-OF-FILE ''sh.h.cdif' X*** ../../../tape3/commands/sh/sh.h Mon Sep 26 13:02:39 1988 X--- sh.h Sun Jan 22 22:59:15 1989 X*************** X*** 156,162 **** X Extern char ourtrap[NSIG]; X Extern int trapset; /* trap pending */ X X! extern int inword; /* defer traps and interrupts */ X X Extern int yynerrs; /* yacc */ X X--- 156,162 ---- X Extern char ourtrap[NSIG]; X Extern int trapset; /* trap pending */ X X! extern int heedint; /* heed interrupt signals */ X X Extern int yynerrs; /* yacc */ X X*************** X*** 235,252 **** X int eqname(/* char *n1, char *n2 */); X X /* -------- io.h -------- */ X /* possible arguments to an IO function */ X struct ioarg { X char *aword; X char **awordlist; X! int afile; /* file descriptor */ X }; X X /* an input generator's state */ X struct io { X int (*iofn)(); X! struct ioarg arg; X int peekc; X char nlcount; /* for `'s */ X char xchar; /* for `'s */ X char task; /* reason for pushed IO */ X--- 235,267 ---- X int eqname(/* char *n1, char *n2 */); X X /* -------- io.h -------- */ X+ /* io buffer */ X+ struct iobuf { X+ unsigned id; /* buffer id */ X+ char buf[512]; /* buffer */ X+ char *bufp; /* pointer into buffer */ X+ char *ebufp; /* pointer to end of buffer */ X+ }; X+ X /* possible arguments to an IO function */ X struct ioarg { X char *aword; X char **awordlist; X! int afile; /* file descriptor */ X! unsigned afid; /* buffer id */ X! long afpos; /* file position */ X! struct iobuf *afbuf; /* buffer for this file */ X }; X+ Extern struct ioarg ioargstack[NPUSH]; X+ #define AFID_NOBUF (~0) X+ #define AFID_ID 0 X X /* an input generator's state */ X struct io { X int (*iofn)(); X! struct ioarg *argp; X int peekc; X+ char prev; /* previous character read by readc() */ X char nlcount; /* for `'s */ X char xchar; /* for `'s */ X char task; /* reason for pushed IO */ X*************** X*** 265,274 **** X */ X int nlchar(); X int strchar(); X int filechar(); X int herechar(); X int linechar(); X- int nextchar(); X int gravechar(); X int qgravechar(); X int dolchar(); X--- 280,289 ---- X */ X int nlchar(); X int strchar(); X+ int qstrchar(); X int filechar(); X int herechar(); X int linechar(); X int gravechar(); X int qgravechar(); X int dolchar(); X*************** X*** 277,282 **** X--- 292,298 ---- X /* X * IO functions X */ X+ int eofc(); X int getc(); X int readc(); X void unget(); X*************** X*** 296,304 **** X void closepipe(); X struct io *setbase(/* struct io * */); X X! Extern struct ioarg temparg; /* temporary for PUSHIO */ X! #define PUSHIO(what,arg,gen) ((temparg.what = (arg)),pushio(temparg,(gen))) X! #define RUN(what,arg,gen) ((temparg.what = (arg)), run(temparg,(gen))) X X /* -------- word.h -------- */ X #ifndef WORD_H X--- 312,320 ---- X void closepipe(); X struct io *setbase(/* struct io * */); X X! extern struct ioarg temparg; /* temporary for PUSHIO */ X! #define PUSHIO(what,arg,gen) ((temparg.what = (arg)),pushio(&temparg,(gen))) X! #define RUN(what,arg,gen) ((temparg.what = (arg)), run(&temparg,(gen))) X X /* -------- word.h -------- */ X #ifndef WORD_H + END-OF-FILE sh.h.cdif chmod 'u=rw,g=r,o=r' 'sh.h.cdif' set `wc -c 'sh.h.cdif'` count=$1 case $count in 3072) :;; *) echo 'Bad character count in ''sh.h.cdif' >&2 echo 'Count should be 3072' >&2 esac echo Extracting 'sh1.c.cdif' sed 's/^X//' > 'sh1.c.cdif' << '+ END-OF-FILE ''sh1.c.cdif' X*** ../../../tape3/commands/sh/sh1.c Mon Sep 26 13:02:39 1988 X--- sh1.c Sun Jan 22 22:59:16 1989 X*************** X*** 16,22 **** X char *flag = flags-'a'; X char *elinep = line+sizeof(line)-5; X char *null = ""; X! int inword =1; X struct env e ={line, iostack, iostack-1, NULL, FDBASE, NULL}; X X extern char **environ; /* environment pointer */ X--- 16,22 ---- X char *flag = flags-'a'; X char *elinep = line+sizeof(line)-5; X char *null = ""; X! int heedint =1; X struct env e ={line, iostack, iostack-1, NULL, FDBASE, NULL}; X X extern char **environ; /* environment pointer */ X*************** X*** 149,158 **** X if ((f = open(".profile", 0)) >= 0) X next(remap(f)); X } X! if (talking) { X signal(SIGTERM, sig); X! signal(SIGINT, SIG_IGN); X! } X dolv = argv; X dolc = argc; X dolv[0] = name; X--- 149,158 ---- X if ((f = open(".profile", 0)) >= 0) X next(remap(f)); X } X! if (talking) X signal(SIGTERM, sig); X! if (signal(SIGINT, SIG_IGN) != SIG_IGN) X! signal(SIGINT, onintr); X dolv = argv; X dolc = argc; X dolv[0] = name; X*************** X*** 207,213 **** X register i; X jmp_buf m1; X X- inword++; X while (e.oenv) X quitenv(); X areanum = 1; X--- 207,212 ---- X*************** X*** 221,254 **** X yynerrs = 0; X multiline = 0; X inparse = 1; X setjmp(failpt = m1); /* Bruce Evans' fix */ X- if (talking) X- signal(SIGINT, onintr); X if (setjmp(failpt = m1) || yyparse() || intr) { X while (e.oenv) X quitenv(); X scraphere(); X inparse = 0; X intr = 0; X return; X } X inparse = 0; X- inword = 0; X- if ((i = trapset) != 0) { X- trapset = 0; X- runtrap(i); X- } X brklist = 0; X intr = 0; X execflg = 0; X! if (!flag['n']) { X! if (talking) X! signal(SIGINT, onintr); X execute(outtree, NOPIPE, NOPIPE, 0); X! intr = 0; X! if (talking) X! signal(SIGINT, SIG_IGN); X } X } X X void X--- 220,252 ---- X yynerrs = 0; X multiline = 0; X inparse = 1; X+ intr = 0; X+ execflg = 0; X setjmp(failpt = m1); /* Bruce Evans' fix */ X if (setjmp(failpt = m1) || yyparse() || intr) { X while (e.oenv) X quitenv(); X scraphere(); X+ if (!talking && intr) X+ leave(); X inparse = 0; X intr = 0; X return; X } X inparse = 0; X brklist = 0; X intr = 0; X execflg = 0; X! if (!flag['n']) X execute(outtree, NOPIPE, NOPIPE, 0); X! if (!talking && intr) { X! execflg = 0; X! leave(); X } X+ if ((i = trapset) != 0) { X+ trapset = 0; X+ runtrap(i); X+ } X } X X void X*************** X*** 263,270 **** X { X if (execflg) X fail(); X runtrap(0); X- sync(); X exit(exstat); X /* NOTREACHED */ X } X--- 261,269 ---- X { X if (execflg) X fail(); X+ scraphere(); X+ freehere(1); X runtrap(0); X exit(exstat); X /* NOTREACHED */ X } X*************** X*** 390,406 **** X X next(f) X { X! PUSHIO(afile, f, nextchar); X } X X onintr() X { X! signal(SIGINT, SIG_IGN); X! if (inparse) { X! prs("\n"); X! fail(); X } X! intr++; X } X X letter(c) X--- 389,411 ---- X X next(f) X { X! PUSHIO(afile, f, filechar); X } X X onintr() X { X! signal(SIGINT, onintr); X! intr = 1; X! if (talking) { X! if (inparse) { X! prs("\n"); X! fail(); X! } X } X! else if (heedint) { X! execflg = 0; X! leave(); X! } X } X X letter(c) X*************** X*** 427,436 **** X { X register char *cp; X X- inword++; X if ((cp = getcell(n)) == 0) X err("out of string space"); X- inword--; X return(cp); X } X X--- 432,439 ---- X*************** X*** 449,466 **** X return(""); X } X X- /* X- * if inword is set, traps X- * are delayed, avoiding X- * having two people allocating X- * at once. X- */ X xfree(s) X register char *s; X { X- inword++; X DELETE(s); X- inword--; X } X X /* X--- 452,461 ---- X*************** X*** 469,479 **** X sig(i) X register i; X { X! if (inword == 0) { X! signal(i, SIG_IGN); X! runtrap(i); X! } else X! trapset = i; X signal(i, sig); X } X X--- 464,470 ---- X sig(i) X register i; X { X! trapset = i; X signal(i, sig); X } X + END-OF-FILE sh1.c.cdif chmod 'u=rw,g=r,o=r' 'sh1.c.cdif' set `wc -c 'sh1.c.cdif'` count=$1 case $count in 3940) :;; *) echo 'Bad character count in ''sh1.c.cdif' >&2 echo 'Count should be 3940' >&2 esac echo Extracting 'sh2.c.cdif' sed 's/^X//' > 'sh2.c.cdif' << '+ END-OF-FILE ''sh2.c.cdif' X*** ../../../tape3/commands/sh/sh2.c Mon Sep 26 13:02:40 1988 X--- sh2.c Sun Jan 22 22:59:16 1989 X*************** X*** 39,46 **** X X /* #include "sh.h" */ X #define SYNTAXERR zzerr() X! static int startl = 1; X! static int peeksym = 0; X static void zzerr(); X static void word(); X static char **copyw(); X--- 39,46 ---- X X /* #include "sh.h" */ X #define SYNTAXERR zzerr() X! static int startl; X! static int peeksym; X static void zzerr(); X static void word(); X static char **copyw(); X*************** X*** 66,71 **** X--- 66,72 ---- X int X yyparse() X { X+ startl = 1; X peeksym = 0; X yynerrs = 0; X outtree = c_list(); X*************** X*** 574,584 **** X char *s; X { X yynerrs++; X! if (talking) { X! if (multiline && nlseen) X! unget('\n'); X multiline = 0; X! while (yylex(0) != '\n') X ; X } X err(s); X--- 575,583 ---- X char *s; X { X yynerrs++; X! if (talking && e.iop <= iostack) { X multiline = 0; X! while (eofc() == 0 && yylex(0) != '\n') X ; X } X err(s); + END-OF-FILE sh2.c.cdif chmod 'u=rw,g=r,o=r' 'sh2.c.cdif' set `wc -c 'sh2.c.cdif'` count=$1 case $count in 994) :;; *) echo 'Bad character count in ''sh2.c.cdif' >&2 echo 'Count should be 994' >&2 esac echo Extracting 'sh3.c.cdif' sed 's/^X//' > 'sh3.c.cdif' << '+ END-OF-FILE ''sh3.c.cdif' X*** ../../../tape3/commands/sh/sh3.c Mon Sep 26 13:02:40 1988 X--- sh3.c Sun Jan 22 22:59:17 1989 X*************** X*** 18,24 **** X "Quit", X "Illegal instruction", X "Trace/BPT trap", X! "abort", X "EMT trap", X "Floating exception", X "Killed", X--- 18,24 ---- X "Quit", X "Illegal instruction", X "Trace/BPT trap", X! "Abort", X "EMT trap", X "Floating exception", X "Killed", X*************** X*** 53,59 **** X return(0); X rv = 0; X a = areanum++; X! wp = (wp2 = t->words) != NULL? eval(wp2, DOALL): NULL; X X switch(t->type) { X case TPAREN: X--- 53,61 ---- X return(0); X rv = 0; X a = areanum++; X! wp = (wp2 = t->words) != NULL X! ? eval(wp2, t->type == TCOM ? DOALL : DOALL & ~DOKEY) X! : NULL; X X switch(t->type) { X case TPAREN: X*************** X*** 118,125 **** X wp = dolv+1; X if ((i = dolc) < 0) X i = 0; X! } else X i = -1; X vp = lookup(t->str); X while (setjmp(bc.brkpt)) X if (isbreak) X--- 120,130 ---- X wp = dolv+1; X if ((i = dolc) < 0) X i = 0; X! } else { X i = -1; X+ while (*wp++ != NULL) X+ ; X+ } X vp = lookup(t->str); X while (setjmp(bc.brkpt)) X if (isbreak) X*************** X*** 178,187 **** X freehere(areanum); X freearea(areanum); X areanum = a; X! if (intr) { X closeall(); X fail(); X } X return(rv); X } X X--- 183,196 ---- X freehere(areanum); X freearea(areanum); X areanum = a; X! if (talking && intr) { X closeall(); X fail(); X } X+ if ((i = trapset) != 0) { X+ trapset = 0; X+ runtrap(i); X+ } X return(rv); X } X X*************** X*** 199,219 **** X char *cp; X struct ioword **iopp; X int resetsig; X X resetsig = 0; X *pforked = 0; X shcom = NULL; X rv = -1; /* system-detected error */ X if (t->type == TCOM) { X /* strip all initial assignments */ X /* not correct wrt PATH=yyy command etc */ X if (flag['x']) X echo(wp); X! while ((cp = *wp++) != NULL && assign(cp, COPYV)) X! ; X! wp--; X! if (cp == NULL && t->ioact == NULL) X return(setstatus(0)); X else if (cp != NULL) X shcom = inbuilt(cp); X } X--- 208,234 ---- X char *cp; X struct ioword **iopp; X int resetsig; X+ char **owp; X X+ owp = wp; X resetsig = 0; X *pforked = 0; X shcom = NULL; X rv = -1; /* system-detected error */ X if (t->type == TCOM) { X+ while ((cp = *wp++) != NULL) X+ ; X+ cp = *wp; X+ X /* strip all initial assignments */ X /* not correct wrt PATH=yyy command etc */ X if (flag['x']) X echo(wp); X! if (cp == NULL && t->ioact == NULL) { X! while ((cp = *owp++) != NULL && assign(cp, COPYV)) X! ; X return(setstatus(0)); X+ } X else if (cp != NULL) X shcom = inbuilt(cp); X } X*************** X*** 239,244 **** X--- 254,262 ---- X brklist = 0; X execflg = 0; X } X+ while ((cp = *owp++) != NULL && assign(cp, COPYV)) X+ if (shcom == NULL) X+ export(lookup(cp)); X #ifdef COMPIPE X if ((pin != NULL || pout != NULL) && shcom != NULL && shcom != doexec) { X err("piping to/from shell builtins not yet done"); X*************** X*** 276,282 **** X exit(execute(t->left, NOPIPE, NOPIPE, FEXEC)); X if (wp[0] == NULL) X exit(0); X! cp = rexecve(wp[0], wp, makenv(wp)); X prs(wp[0]); prs(": "); warn(cp); X if (!execflg) X trap[0] = NULL; X--- 294,300 ---- X exit(execute(t->left, NOPIPE, NOPIPE, FEXEC)); X if (wp[0] == NULL) X exit(0); X! cp = rexecve(wp[0], wp, makenv()); X prs(wp[0]); prs(": "); warn(cp); X if (!execflg) X trap[0] = NULL; X*************** X*** 449,455 **** X--- 467,475 ---- X { X register int pid, rv; X int s; X+ int oheedint = heedint; X X+ heedint = 0; X rv = 0; X do { X pid = wait(&s); X*************** X*** 475,488 **** X } X if (WAITCORE(s)) X prs(" - core dumped"); X! prs("\n"); X rv = -1; X } else X rv = WAITVAL(s); X } X- /* Special patch for MINIX: sync before each command */ X- sync(); X } while (pid != lastpid); X return(rv); X } X X--- 495,515 ---- X } X if (WAITCORE(s)) X prs(" - core dumped"); X! if (rv >= NSIGNAL || signame[rv]) X! prs("\n"); X rv = -1; X } else X rv = WAITVAL(s); X } X } while (pid != lastpid); X+ heedint = oheedint; X+ if (intr) X+ if (talking) { X+ if (canintr) X+ intr = 0; X+ } X+ else X+ onintr(); X return(rv); X } X X*************** X*** 551,558 **** X * Run the command produced by generator `f' X * applied to stream `arg'. X */ X! run(arg, f) X! struct ioarg arg; X int (*f)(); X { X struct op *otree; X--- 578,585 ---- X * Run the command produced by generator `f' X * applied to stream `arg'. X */ X! run(argp, f) X! struct ioarg *argp; X int (*f)(); X { X struct op *otree; X*************** X*** 571,577 **** X if (newenv(setjmp(errpt = ev)) == 0) { X wdlist = 0; X iolist = 0; X! pushio(arg, f); X e.iobase = e.iop; X yynerrs = 0; X if (setjmp(failpt = rt) == 0 && yyparse() == 0) X--- 598,604 ---- X if (newenv(setjmp(errpt = ev)) == 0) { X wdlist = 0; X iolist = 0; X! pushio(argp, f); X e.iobase = e.iop; X yynerrs = 0; X if (setjmp(failpt = rt) == 0 && yyparse() == 0) X*************** X*** 647,653 **** X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X } X! cp = rexecve(t->words[0], t->words, makenv(t->words)); X prs(t->words[0]); prs(": "); err(cp); X return(1); X } X--- 674,680 ---- X signal(SIGINT, SIG_DFL); X signal(SIGQUIT, SIG_DFL); X } X! cp = rexecve(t->words[0], t->words, makenv()); X prs(t->words[0]); prs(": "); err(cp); X return(1); X } X*************** X*** 734,744 **** X return(0); X } else X i = -1; X- if (talking) X- signal(SIGINT, onintr); X setstatus(waitfor(i, 1)); X- if (talking) X- signal(SIGINT, SIG_IGN); X return(0); X } X X--- 761,767 ---- X*************** X*** 799,806 **** X setsig(n, sig); X } else X setsig(n, SIG_IGN); X! } else X! setsig(n, (n == SIGINT || n == SIGQUIT) && talking? SIG_IGN: SIG_DFL); X return(0); X } X X--- 822,836 ---- X setsig(n, sig); X } else X setsig(n, SIG_IGN); X! } else { X! if (talking) X! if (n == SIGINT) X! setsig(n, onintr); X! else X! setsig(n, n == SIGQUIT ? SIG_IGN : SIG_DFL); X! else X! setsig(n, SIG_DFL); X! } X return(0); X } X + END-OF-FILE sh3.c.cdif chmod 'u=rw,g=r,o=r' 'sh3.c.cdif' set `wc -c 'sh3.c.cdif'` count=$1 case $count in 6171) :;; *) echo 'Bad character count in ''sh3.c.cdif' >&2 echo 'Count should be 6171' >&2 esac echo Extracting 'sh4.c.cdif' sed 's/^X//' > 'sh4.c.cdif' << '+ END-OF-FILE ''sh4.c.cdif' X*** ../../../tape3/commands/sh/sh4.c Mon Sep 26 13:02:41 1988 X--- sh4.c Sun Jan 22 22:59:18 1989 X*************** X*** 30,62 **** X { X struct wdblock *wb; X char **wp; X jmp_buf ev; X X- inword++; X wp = NULL; X wb = NULL; X if (newenv(setjmp(errpt = ev)) == 0) { X! wb = addword((char *)0, wb); /* space for shell name, if command file */ X! while (expand(*ap++, &wb, f)) X! ; X wb = addword((char *)0, wb); X! wp = getwords(wb) + 1; X quitenv(); X } else X gflg = 1; X- inword--; X return(gflg? NULL: wp); X } X X /* X * Make the exported environment from the exported X! * names in the dictionary. Keyword assignments X! * ought to be taken from wp (the list of words on the command line) X! * but aren't, yet. Until then: ARGSUSED X */ X char ** X! makenv(wp) X! char **wp; X { X register struct wdblock *wb; X register struct var *vp; X--- 30,70 ---- X { X struct wdblock *wb; X char **wp; X+ char **wf; X jmp_buf ev; X X wp = NULL; X wb = NULL; X+ wf = NULL; X if (newenv(setjmp(errpt = ev)) == 0) { X! while (isassign(*ap)) X! expand(*ap++, &wb, f & ~DOGLOB); X! if (flag['k']) { X! for (wf = ap; *wf; wf++) { X! if (isassign(*wf)) X! expand(*wf, &wb, f & ~DOGLOB); X! } X! } X! for (wb = addword((char *)0, wb); *ap; ap++) { X! if (!flag['k'] || !isassign(*ap)) X! expand(*ap, &wb, f & ~DOKEY); X! } X wb = addword((char *)0, wb); X! wp = getwords(wb); X quitenv(); X } else X gflg = 1; X return(gflg? NULL: wp); X } X X /* X * Make the exported environment from the exported X! * names in the dictionary. Keyword assignments X! * will already have been done. X */ X char ** X! makenv() X! X { X register struct wdblock *wb; X register struct var *vp; X*************** X*** 76,82 **** X { X struct wdblock *wb; X X- inword++; X wb = NULL; X if (expand(cp, &wb, f)) { X if (wb == NULL || wb->w_nword == 0 || (cp = wb->w_words[0]) == NULL) X--- 84,89 ---- X*************** X*** 84,90 **** X DELETE(wb); X } else X cp = NULL; X- inword--; X return(cp); X } X X--- 91,96 ---- X*************** X*** 134,144 **** X { X register c, c1; X register char *sp; X X sp = e.linep; X X loop: X! switch (c = subgetc('"', 0)) { X case 0: X if (sp == e.linep) X return(0); X--- 140,153 ---- X { X register c, c1; X register char *sp; X+ int scanequals, foundequals; X X sp = e.linep; X+ scanequals = f & DOKEY; X+ foundequals = 0; X X loop: X! switch (c = subgetc('"', foundequals)) { X case 0: X if (sp == e.linep) X return(0); X*************** X*** 152,157 **** X--- 161,167 ---- X X case '"': X case '\'': X+ scanequals = 0; X if (INSUB()) X break; X for (c1 = c; (c = subgetc(c1, 1)) != c1;) { X*************** X*** 164,179 **** X c = 0; X } X unget(c); X for (;;) { X! c = subgetc('"', 0); X if (c == 0 || X f & DOBLANK && any(c, ifs->value) || X! !INSUB() && any(c, "\"'`")) { X unget(c); X! if (any(c, "\"'`")) X goto loop; X break; X } X *e.linep++ = c; X } X *e.linep++ = 0; X--- 174,199 ---- X c = 0; X } X unget(c); X+ if (!letter(c)) X+ scanequals = 0; X for (;;) { X! c = subgetc('"', foundequals); X if (c == 0 || X f & DOBLANK && any(c, ifs->value) || X! !INSUB() && any(c, "\"'")) { X! scanequals = 0; X unget(c); X! if (any(c, "\"'")) X goto loop; X break; X } X+ if (scanequals) X+ if (c == '=') { X+ foundequals = 1; X+ scanequals = 0; X+ } X+ else if (!letnum(c)) X+ scanequals = 0; X *e.linep++ = c; X } X *e.linep++ = 0; X*************** X*** 305,311 **** X gflg++; X } X e.linep = s; X! PUSHIO(aword, dolp, strchar); X return(0); X } X X--- 325,331 ---- X gflg++; X } X e.linep = s; X! PUSHIO(aword, dolp, quoted ? qstrchar : strchar); X return(0); X } X X*************** X*** 320,326 **** X register int i; X int pf[2]; X X! for (cp = e.iop->arg.aword; *cp != '`'; cp++) X if (*cp == 0) { X err("no closing `"); X return(0); X--- 340,346 ---- X register int i; X int pf[2]; X X! for (cp = e.iop->argp->aword; *cp != '`'; cp++) X if (*cp == 0) { X err("no closing `"); X return(0); X*************** X*** 333,339 **** X return(0); X } X if (i != 0) { X! e.iop->arg.aword = ++cp; X close(pf[1]); X PUSHIO(afile, remap(pf[0]), quoted? qgravechar: gravechar); X return(1); X--- 353,359 ---- X return(0); X } X if (i != 0) { X! e.iop->argp->aword = ++cp; X close(pf[1]); X PUSHIO(afile, remap(pf[0]), quoted? qgravechar: gravechar); X return(1); X*************** X*** 348,354 **** X flag['e'] = 0; X flag['v'] = 0; X flag['n'] = 0; X! cp = strsave(e.iop->arg.aword, 0); X areanum = 1; X freehere(areanum); X freearea(areanum); /* free old space */ X--- 368,374 ---- X flag['e'] = 0; X flag['v'] = 0; X flag['n'] = 0; X! cp = strsave(e.iop->argp->aword, 0); X areanum = 1; X freehere(areanum); X freearea(areanum); /* free old space */ + END-OF-FILE sh4.c.cdif chmod 'u=rw,g=r,o=r' 'sh4.c.cdif' set `wc -c 'sh4.c.cdif'` count=$1 case $count in 4897) :;; *) echo 'Bad character count in ''sh4.c.cdif' >&2 echo 'Count should be 4897' >&2 esac echo Extracting 'sh5.c.cdif' sed 's/^X//' > 'sh5.c.cdif' << '+ END-OF-FILE ''sh5.c.cdif' X*** ../../../tape3/commands/sh/sh5.c Mon Sep 26 13:02:41 1988 X--- sh5.c Sun Jan 22 22:59:18 1989 X*************** X*** 11,17 **** X--- 11,22 ---- X * shell IO X */ X X+ static struct iobuf sharedbuf = {AFID_NOBUF}; X+ static struct iobuf mainbuf = {AFID_NOBUF}; X+ static unsigned bufid = AFID_ID; /* buffer id counter */ X X+ struct ioarg temparg = {0, 0, 0, AFID_NOBUF, 0}; X+ X int X getc(ec) X register int ec; X*************** X*** 45,70 **** X } X X int X readc() X { X register c; X- static int eofc; X X for (; e.iop >= e.iobase; e.iop--) X if ((c = e.iop->peekc) != '\0') { X e.iop->peekc = 0; X return(c); X- } else if ((c = (*e.iop->iofn)(&e.iop->arg, e.iop)) != '\0') { X- if (c == -1) { X- e.iop++; X- continue; X- } X- if (e.iop == iostack) X- ioecho(c); X- return(c); X } X! if (e.iop >= iostack || X! multiline && eofc++ < 3) X return(0); X leave(); X /* NOTREACHED */ X--- 50,97 ---- X } X X int X+ eofc() X+ X+ { X+ return e.iop < e.iobase || (e.iop->peekc == 0 && e.iop->prev == 0); X+ } X+ X+ int X readc() X { X register c; X X for (; e.iop >= e.iobase; e.iop--) X if ((c = e.iop->peekc) != '\0') { X e.iop->peekc = 0; X return(c); X } X! else { X! if (e.iop->prev != 0) { X! if ((c = (*e.iop->iofn)(e.iop->argp, e.iop)) != '\0') { X! if (c == -1) { X! e.iop++; X! continue; X! } X! if (e.iop == iostack) X! ioecho(c); X! return(e.iop->prev = c); X! } X! else if (e.iop->task == XIO && e.iop->prev != '\n') { X! e.iop->prev = 0; X! if (e.iop == iostack) X! ioecho('\n'); X! return '\n'; X! } X! } X! if (e.iop->task == XIO) { X! if (multiline) X! return e.iop->prev = 0; X! if (talking && e.iop == iostack+1) X! prs(prompt->value); X! } X! } X! if (e.iop >= iostack) X return(0); X leave(); X /* NOTREACHED */ X*************** X*** 79,86 **** X } X X void X! pushio(arg, fn) X! struct ioarg arg; X int (*fn)(); X { X if (++e.iop >= &iostack[NPUSH]) { X--- 106,113 ---- X } X X void X! pushio(argp, fn) X! struct ioarg *argp; X int (*fn)(); X { X if (++e.iop >= &iostack[NPUSH]) { X*************** X*** 90,100 **** X return; X } X e.iop->iofn = fn; X! e.iop->arg = arg; X e.iop->peekc = 0; X e.iop->xchar = 0; X e.iop->nlcount = 0; X! if (fn == filechar || fn == linechar || fn == nextchar) X e.iop->task = XIO; X else if (fn == gravechar || fn == qgravechar) X e.iop->task = XGRAVE; X--- 117,143 ---- X return; X } X e.iop->iofn = fn; X! X! if (argp->afid != AFID_NOBUF) X! e.iop->argp = argp; X! else { X! e.iop->argp = ioargstack + (e.iop - iostack); X! *e.iop->argp = *argp; X! e.iop->argp->afbuf = e.iop == &iostack[0] ? &mainbuf : &sharedbuf; X! if (isatty(e.iop->argp->afile) == 0 && X! (e.iop == &iostack[0] || X! lseek(e.iop->argp->afile, 0L, 1) != -1)) { X! if (++bufid == AFID_NOBUF) X! bufid = AFID_ID; X! e.iop->argp->afid = bufid; X! } X! } X! X! e.iop->prev = ~'\n'; X e.iop->peekc = 0; X e.iop->xchar = 0; X e.iop->nlcount = 0; X! if (fn == filechar || fn == linechar) X e.iop->task = XIO; X else if (fn == gravechar || fn == qgravechar) X e.iop->task = XGRAVE; X*************** X*** 162,168 **** X * Return the characters of a list of words, X * producing a space between them. X */ X! static int xxchar(), qqchar(); X X int X dolchar(ap) X--- 205,211 ---- X * Return the characters of a list of words, X * producing a space between them. X */ X! static int xxchar(); X X int X dolchar(ap) X*************** X*** 171,177 **** X register char *wp; X X if ((wp = *ap->awordlist++) != NULL) { X! PUSHIO(aword, wp, *ap->awordlist == NULL? qqchar: xxchar); X return(-1); X } X return(0); X--- 214,220 ---- X register char *wp; X X if ((wp = *ap->awordlist++) != NULL) { X! PUSHIO(aword, wp, *ap->awordlist == NULL? strchar: xxchar); X return(-1); X } X return(0); X*************** X*** 192,220 **** X return(c); X } X X! static int X! qqchar(ap) X register struct ioarg *ap; X { X register int c; X X! if (ap->aword == NULL || (c = *ap->aword++) == '\0') X return(0); X return(c); X } X X /* X! * Produce the characters from a single word (string). X */ X int X! strchar(ap) X register struct ioarg *ap; X { X register int c; X X! if (ap->aword == 0 || (c = *ap->aword++) == 0) X return(0); X! return(c); X } X X /* X--- 235,266 ---- X return(c); X } X X! /* X! * Produce the characters from a single word (string). X! */ X! int X! strchar(ap) X register struct ioarg *ap; X { X register int c; X X! if (ap->aword == NULL || (c = *ap->aword++) == 0) X return(0); X return(c); X } X X /* X! * Produce quoted characters from a single word (string). X */ X int X! qstrchar(ap) X register struct ioarg *ap; X { X register int c; X X! if (ap->aword == NULL || (c = *ap->aword++) == 0) X return(0); X! return(c|QUOTE); X } X X /* X*************** X*** 226,233 **** X--- 272,298 ---- X { X register int i; X char c; X+ struct iobuf *bp = ap->afbuf; X extern int errno; X X+ if (ap->afid != AFID_NOBUF) { X+ if ((i = ap->afid != bp->id) || bp->bufp == bp->ebufp) { X+ if (i) X+ lseek(ap->afile, ap->afpos, 0); X+ do { X+ i = read(ap->afile, bp->buf, sizeof(bp->buf)); X+ } while (i < 0 && errno == EINTR); X+ if (i <= 0) { X+ closef(ap->afile); X+ return 0; X+ } X+ bp->id = ap->afid; X+ bp->ebufp = (bp->bufp = bp->buf) + i; X+ } X+ ap->afpos++; X+ return *bp->bufp++ & 0177; X+ } X+ X do { X i = read(ap->afile, &c, sizeof(c)); X } while (i < 0 && errno == EINTR); X*************** X*** 313,335 **** X return(c); X } X X- /* X- * Return the next character from the command source, X- * prompting when required. X- */ X- int X- nextchar(ap) X- register struct ioarg *ap; X- { X- register int c; X- X- if ((c = filechar(ap)) != 0) X- return(c); X- if (talking && e.iop <= iostack+1) X- prs(prompt->value); X- return(0); X- } X- X void X prs(s) X register char *s; X--- 378,383 ---- X*************** X*** 433,442 **** X static struct here *inhere; /* list of hear docs while parsing */ X static struct here *acthere; /* list of active here documents */ X X! static char *readhere(); X X- #define NCPB 100 /* here text block allocation unit */ X- X markhere(s, iop) X register char *s; X struct ioword *iop; X--- 481,488 ---- X static struct here *inhere; /* list of hear docs while parsing */ X static struct here *acthere; /* list of active here documents */ X X! static void readhere(); X X markhere(s, iop) X register char *s; X struct ioword *iop; X*************** X*** 450,455 **** X--- 496,502 ---- X if (h->h_tag == 0) X return; X h->h_iop = iop; X+ iop->io_name = 0; X h->h_next = NULL; X if (inhere == 0) X inhere = h; X*************** X*** 470,489 **** X X gethere() X { X! register struct here *h; X X! for (h = inhere; h != NULL; h = inhere) { X! h->h_iop->io_name = readhere(h->h_tag, h->h_dosub? 0: '\''); X! /* relink from inhere to acthere list */ X! inhere = h->h_next; X! h->h_next = acthere; X! acthere = h; X } X- inhere = h; X } X X! static char * X! readhere(s, ec) X register char *s; X { X int tf; X--- 517,539 ---- X X gethere() X { X! register struct here *h, *hp; X X! /* Scan here files first leaving inhere list in place */ X! for (hp = h = inhere; h != NULL; hp = h, h = h->h_next) X! readhere(&h->h_iop->io_name, h->h_tag, h->h_dosub? 0: '\''); X! X! /* Make inhere list active - keep list intact for scraphere */ X! if (hp != NULL) { X! hp->h_next = acthere; X! acthere = inhere; X! inhere = NULL; X } X } X X! static void X! readhere(name, s, ec) X! char **name; X register char *s; X { X int tf; X*************** X*** 494,534 **** X char *next; X X tempname(tname); X tf = creat(tname, 0600); X if (tf < 0) X! return (0); X if (newenv(setjmp(errpt = ev)) != 0) X! return (0); X! if (e.iop == iostack && e.iop->iofn == filechar) { X! pushio(e.iop->arg, filechar); X e.iobase = e.iop; X! } X! for (;;) { X! if (talking && e.iop <= iostack) X! prs(cprompt->value); X! next = line; X! while ((c = getc(ec)) != '\n' && c) { X! if (ec == '\'') X! c &= ~ QUOTE; X! if (next >= &line[LINELIM]) { X! c = 0; X! break; X } X! *next++ = c; X } X! *next = 0; X! if (strcmp(s, line) == 0 || c == 0) X! break; X! *next++ = '\n'; X! write (tf, line, (int)(next-line)); X } X- if (c == 0) { X- prs("here document `"); prs(s); err("' unclosed"); X- } X close(tf); X- quitenv(); X- /* correct area? */ X- return (strsave(tname, areanum)); X } X X /* X--- 544,583 ---- X char *next; X X tempname(tname); X+ *name = strsave(tname, areanum); X tf = creat(tname, 0600); X if (tf < 0) X! return; X if (newenv(setjmp(errpt = ev)) != 0) X! unlink(tname); X! else { X! pushio(e.iop->argp, e.iop->iofn); X e.iobase = e.iop; X! for (;;) { X! if (talking && e.iop <= iostack) X! prs(cprompt->value); X! next = line; X! while ((c = getc(ec)) != '\n' && c) { X! if (ec == '\'') X! c &= ~ QUOTE; X! if (next >= &line[LINELIM]) { X! c = 0; X! break; X! } X! *next++ = c; X } X! *next = 0; X! if (strcmp(s, line) == 0 || c == 0) X! break; X! *next++ = '\n'; X! write (tf, line, (int)(next-line)); X } X! if (c == 0) { X! prs("here document `"); prs(s); err("' unclosed"); X! } X! quitenv(); X } X close(tf); X } X X /* X*************** X*** 573,578 **** X--- 622,633 ---- X X scraphere() X { X+ register struct here *h; X+ X+ for (h = inhere; h != NULL; h = h->h_next) { X+ if (h->h_iop && h->h_iop->io_name) X+ unlink(h->h_iop->io_name); X+ } X inhere = NULL; X } X + END-OF-FILE sh5.c.cdif chmod 'u=rw,g=r,o=r' 'sh5.c.cdif' set `wc -c 'sh5.c.cdif'` count=$1 case $count in 9711) :;; *) echo 'Bad character count in ''sh5.c.cdif' >&2 echo 'Count should be 9711' >&2 esac echo Extracting 'sh6.c.cdif' sed 's/^X//' > 'sh6.c.cdif' << '+ END-OF-FILE ''sh6.c.cdif' X*** ../../../tape3/commands/sh/sh6.c Mon Sep 26 13:02:42 1988 X--- sh6.c Sun Jan 22 22:59:18 1989 + END-OF-FILE sh6.c.cdif chmod 'u=rw,g=r,o=r' 'sh6.c.cdif' set `wc -c 'sh6.c.cdif'` count=$1 case $count in 97) :;; *) echo 'Bad character count in ''sh6.c.cdif' >&2 echo 'Count should be 97' >&2 esac exit 0