Index: trunk/minix/commands/ash/bltin/LICENSE
===================================================================
--- trunk/minix/commands/ash/bltin/LICENSE	(revision 9)
+++ 	(revision )
@@ -1,40 +1,0 @@
-		    ASH GENERAL PUBLIC LICENSE
-
-  1. You may copy and distribute ash code or code derived from it in
-source or object form, provided that you conspicuously and appropriately
-publish on each copy a valid copyright notice "Copyright 1989 by Kenneth
-Almquist." (or with whatever year is appropriate); keep intact the
-notices on all files that refer to this License Agreement and to the
-absence of any warranty; and give any other recipients of the ash program
-a copy of this License Agreement along with the program.
-
-  2. You may not copy, sublicense, distribute or transfer ash except as
-expressly provided under this License Agreement.  Any attempt otherwise
-to copy, sublicense, distribute or transfer ash is void and your rights
-to use ash under this License agreement shall be automatically terminated.
-However, parties who have received computer software programs from you
-with this License Agreement will not have their licenses terminated so
-long as such parties remain in full compliance.
-
-
-			   NO WARRANTY
-
-  Because ash is licensed free of charge, I provide absolutely no
-warranty, to the extent permitted by applicable state law.  Except
-when otherwise stated in writing, Kenneth Almquist and/or other
-parties provide ash "as is" without warranty of any kind, either
-expressed or implied, including, but not limited to, the implied
-warranties of merchantability and fitness for a particular purpose.
-The entire risk as to the quality and performance of the program is
-with you.  Should the ash program prove defective, you assume the cost
-of all necessary servicing, repair or correction.
-
- In no event unless required by applicable law will Kenneth Almquist
-and/or any other party who may modify and redistribute ash as permitted
-above, be liable to you for damages, including any lost profits, lost
-monies, or other special, incidental or consequential damages arising
-out of the use or inability to use (including but not limited to loss
-of data or data being rendered inaccurate or losses sustained by third
-parties or a failure of the program to operate with programs provided
-by other parties) the program, even if you have been advised of the
-possibility of such damages, or for any claim by any other party.
Index: trunk/minix/commands/ash/bltin/binary_op
===================================================================
--- trunk/minix/commands/ash/bltin/binary_op	(revision 9)
+++ 	(revision )
@@ -1,25 +1,0 @@
-# List of binary operators used by test/expr.
-#
-# Copyright 1989 by Kenneth Almquist.  All rights reserved.
-# This file is part of ash, which is distributed under the terms specified
-# by the Ash General Public License.  See the file named LICENSE.
-
-OR1	 -o	1
-OR2	 |	1
-AND1	 -a	2
-AND2	 &	2
-STREQ	 =	4    OP_STRING
-STRNE	 !=	4    OP_STRING
-NEWER	 -newer	4    OP_STRING
-EQ	 -eq	4    OP_INT
-NE	 -ne	4    OP_INT
-GT	 -gt	4    OP_INT
-LT	 -lt	4    OP_INT
-LE	 -le	4    OP_INT
-GE	 -ge	4    OP_INT
-PLUS	 +	5    OP_INT
-MINUS	 -	5    OP_INT
-TIMES	 *	6    OP_INT
-DIVIDE	 /	6    OP_INT
-REM	 %	6    OP_INT
-MATCHPAT :	7    OP_STRING
Index: trunk/minix/commands/ash/bltin/bltin.h
===================================================================
--- trunk/minix/commands/ash/bltin/bltin.h	(revision 9)
+++ 	(revision )
@@ -1,40 +1,0 @@
-/*
- * This file is included by programs which are optionally built into the
- * shell.  If SHELL is defined, we try to map the standard UNIX library
- * routines to ash routines using defines.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#include "../shell.h"
-#include "../mystring.h"
-#ifdef SHELL
-#include "../output.h"
-#define stdout out1
-#define stderr out2
-#define printf out1fmt
-#define putc(c, file)	outc(c, file)
-#define putchar(c)	out1c(c)
-#define fprintf outfmt
-#define fputs outstr
-#define fflush flushout
-#define INITARGS(argv)
-#else
-#undef NULL
-#include <stdio.h>
-#undef main
-#define INITARGS(argv)	if ((commandname = argv[0]) == NULL) {fputs("Argc is zero\n", stderr); exit(2);} else
-#endif
-
-#ifdef __STDC__
-pointer stalloc(int);
-void error(char *, ...);
-#else
-pointer stalloc();
-void error();
-#endif
-
-
-extern char *commandname;
Index: trunk/minix/commands/ash/bltin/catf.c
===================================================================
--- trunk/minix/commands/ash/bltin/catf.c	(revision 9)
+++ 	(revision )
@@ -1,88 +1,0 @@
-/*
- * Copy the files given as arguments to the standard output.  The file
- * name "-" refers to the standard input.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#define main catfcmd
-
-#include "bltin.h"
-#include "../error.h"
-#include <sys/param.h>
-#include <fcntl.h>
-
-
-#ifdef SBUFSIZE
-#define BUFSIZE() SBUFSIZE
-#else
-#ifdef MAXBSIZE
-#define BUFSIZE() MAXBSIZE
-#else
-#define BUFSIZE() BSIZE
-#endif
-#endif
-
-
-main(argc, argv)  char **argv; {
-      char *filename;
-      char *buf = stalloc(BUFSIZE());
-      int fd;
-      int i;
-#ifdef SHELL
-      volatile int input;
-      struct jmploc jmploc;
-      struct jmploc *volatile savehandler;
-#endif
-
-      INITARGS(argv);
-#ifdef SHELL
-      input = -1;
-      if (setjmp(jmploc.loc)) {
-	    close(input);
-	    handler = savehandler;
-	    longjmp(handler, 1);
-      }
-      savehandler = handler;
-      handler = &jmploc;
-#endif
-      while ((filename = *++argv) != NULL) {
-	    if (filename[0] == '-' && filename[1] == '\0') {
-		  fd = 0;
-	    } else {
-#ifdef SHELL
-		  INTOFF;
-		  if ((fd = open(filename, O_RDONLY)) < 0)
-			error("Can't open %s", filename);
-		  input = fd;
-		  INTON;
-#else
-		  if ((fd = open(filename, O_RDONLY)) < 0) {
-			fprintf(stderr, "catf: Can't open %s\n", filename);
-			exit(2);
-		  }
-#endif
-	    }
-	    while ((i = read(fd, buf, BUFSIZE())) > 0) {
-#ifdef SHELL
-		  if (out1 == &memout) {
-			register char *p;
-			for (p = buf ; --i >= 0 ; p++) {
-			      outc(*p, &memout);
-			}
-		  } else {
-			write(1, buf, i);
-		  }
-#else
-		  write(1, buf, i);
-#endif
-	    }
-	    if (fd != 0)
-		  close(fd);
-      }
-#ifdef SHELL
-      handler = savehandler;
-#endif
-}
Index: trunk/minix/commands/ash/bltin/echo.c
===================================================================
--- trunk/minix/commands/ash/bltin/echo.c	(revision 9)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Echo command.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#define main echocmd
-
-#include "bltin.h"
-
-#undef eflag
-
-
-main(argc, argv)  char **argv; {
-      register char **ap;
-      register char *p;
-      register char c;
-      int count;
-      int nflag = 0;
-#ifndef eflag
-      int eflag = 0;
-#endif
-
-      ap = argv;
-      if (argc)
-	    ap++;
-      if ((p = *ap) != NULL) {
-	    if (equal(p, "--")) {
-		  ap++;
-	    }
-	    if (equal(p, "-n")) {
-		  nflag++;
-		  ap++;
-	    } else if (equal(p, "-e")) {
-#ifndef eflag
-		  eflag++;
-#endif
-		  ap++;
-	    }
-      }
-      while ((p = *ap++) != NULL) {
-	    while ((c = *p++) != '\0') {
-		  if (c == '\\' && eflag) {
-			switch (*p++) {
-			case 'b':  c = '\b';  break;
-			case 'c':  return 0;		/* exit */
-			case 'f':  c = '\f';  break;
-			case 'n':  c = '\n';  break;
-			case 'r':  c = '\r';  break;
-			case 't':  c = '\t';  break;
-			case 'v':  c = '\v';  break;
-			case '\\':  break;		/* c = '\\' */
-			case '0':
-			      c = 0;
-			      count = 3;
-			      while (--count >= 0 && (unsigned)(*p - '0') < 8)
-				    c = (c << 3) + (*p++ - '0');
-			      break;
-			default:
-			      p--;
-			      break;
-			}
-		  }
-		  putchar(c);
-	    }
-	    if (*ap)
-		  putchar(' ');
-      }
-      if (! nflag)
-	    putchar('\n');
-      return 0;
-}
Index: trunk/minix/commands/ash/bltin/error.c
===================================================================
--- trunk/minix/commands/ash/bltin/error.c	(revision 9)
+++ 	(revision )
@@ -1,23 +1,0 @@
-/*
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#include <stdio.h>
-
-char *commandname;
-
-
-void
-#ifdef __STDC__
-error(char *msg, ...) {
-#else
-error(msg)
-      char *msg;
-      {
-#endif
-
-      fprintf(stderr, "%s: %s\n", commandname, msg);
-      exit(2);
-}
Index: trunk/minix/commands/ash/bltin/expr.c
===================================================================
--- trunk/minix/commands/ash/bltin/expr.c	(revision 9)
+++ 	(revision )
@@ -1,481 +1,0 @@
-/*
- * The expr and test commands.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-
-#define main exprcmd
-
-#include "bltin.h"
-#include "operators.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef S_ISLNK
-#define lstat		stat
-#define S_ISLNK(mode)	(0)
-#endif
-
-#define STACKSIZE 12
-#define NESTINCR 16
-
-/* data types */
-#define STRING 0
-#define INTEGER 1
-#define BOOLEAN 2
-
-
-/*
- * This structure hold a value.  The type keyword specifies the type of
- * the value, and the union u holds the value.  The value of a boolean
- * is stored in u.num (1 = TRUE, 0 = FALSE).
- */
-
-struct value {
-      int type;
-      union {
-	    char *string;
-	    long num;
-      } u;
-};
-
-
-struct operator {
-      short op;			/* which operator */
-      short pri;		/* priority of operator */
-};
-
-
-struct filestat {
-      int op;			/* OP_FILE or OP_LFILE */
-      char *name;		/* name of file */
-      int rcode;		/* return code from stat */
-      struct stat stat;		/* status info on file */
-};
-
-
-extern char *match_begin[10];	/* matched string */
-extern short match_length[10];	/* defined in regexp.c */
-extern short number_parens;	/* number of \( \) pairs */
-
-
-#ifdef __STDC__
-int expr_is_false(struct value *);
-void expr_operator(int, struct value *, struct filestat *);
-int lookup_op(char *, char *const*);
-char *re_compile(char *);	/* defined in regexp.c */
-int re_match(char *, char *);	/* defined in regexp.c */
-long atol(const char *);
-#else
-int expr_is_false();
-void expr_operator();
-int lookup_op();
-char *re_compile();	/* defined in regexp.c */
-int re_match();	/* defined in regexp.c */
-long atol();
-#endif
-
-
-
-main(argc, argv)  char **argv; {
-      char **ap;
-      char *opname;
-      char c;
-      char *p;
-      int print;
-      int nest;		/* parenthises nesting */
-      int op;
-      int pri;
-      int skipping;
-      int binary;
-      struct operator opstack[STACKSIZE];
-      struct operator *opsp;
-      struct value valstack[STACKSIZE + 1];
-      struct value *valsp;
-      struct filestat fs;
-
-      INITARGS(argv);
-      c = **argv;
-      print = 1;
-      if (c == 't')
-	    print = 0;
-      else if (c == '[') {
-	    if (! equal(argv[argc - 1], "]"))
-		  error("missing ]");
-	    argv[argc - 1] = NULL;
-	    print = 0;
-      }
-      ap = argv + 1;
-      fs.name = NULL;
-
-      /*
-       * We use operator precedence parsing, evaluating the expression
-       * as we parse it.  Parentheses are handled by bumping up the
-       * priority of operators using the variable "nest."  We use the
-       * variable "skipping" to turn off evaluation temporarily for the
-       * short circuit boolean operators.  (It is important do the short
-       * circuit evaluation because under NFS a stat operation can take
-       * infinitely long.)
-       */
-
-      nest = 0;
-      skipping = 0;
-      opsp = opstack + STACKSIZE;
-      valsp = valstack;
-      if (*ap == NULL) {
-	    valstack[0].type = BOOLEAN;
-	    valstack[0].u.num = 0;
-	    goto done;
-      }
-      for (;;) {
-	    opname = *ap++;
-	    if (opname == NULL)
-syntax:		  error("syntax error");
-	    if (opname[0] == '(' && opname[1] == '\0') {
-		  nest += NESTINCR;
-		  continue;
-	    } else if (*ap && (op = lookup_op(opname, unary_op)) >= 0) {
-		  if (opsp == &opstack[0])
-overflow:		error("Expression too complex");
-		  --opsp;
-		  opsp->op = op;
-		  opsp->pri = op_priority[op] + nest;
-		  continue;
-
-	    } else {
-		  valsp->type = STRING;
-		  valsp->u.string = opname;
-		  valsp++;
-	    }
-	    for (;;) {
-		  opname = *ap++;
-		  if (opname == NULL) {
-			if (nest != 0)
-			      goto syntax;
-			pri = 0;
-			break;
-		  }
-		  if (opname[0] != ')' || opname[1] != '\0') {
-			if ((op = lookup_op(opname, binary_op)) < 0)
-			      goto syntax;
-			op += FIRST_BINARY_OP;
-			pri = op_priority[op] + nest;
-			break;
-		  }
-		  if ((nest -= NESTINCR) < 0)
-			goto syntax;
-	    }
-	    while (opsp < &opstack[STACKSIZE] && opsp->pri >= pri) {
-		  binary = opsp->op;
-		  for (;;) {
-			valsp--;
-			c = op_argflag[opsp->op];
-			if (c == OP_INT) {
-			      if (valsp->type == STRING)
-				    valsp->u.num = atol(valsp->u.string);
-			      valsp->type = INTEGER;
-			} else if (c >= OP_STRING) { /* OP_STRING or OP_FILE */
-			      if (valsp->type == INTEGER) {
-				    p = stalloc(32);
-#ifdef SHELL
-				    fmtstr(p, 32, "%d", valsp->u.num);
-#else
-				    sprintf(p, "%d", valsp->u.num);
-#endif
-				    valsp->u.string = p;
-			      } else if (valsp->type == BOOLEAN) {
-				    if (valsp->u.num)
-					  valsp->u.string = "true";
-				    else
-					  valsp->u.string = "";
-			      }
-			      valsp->type = STRING;
-			      if (c >= OP_FILE
-			       && (fs.op != c
-			           || fs.name == NULL
-			           || ! equal(fs.name, valsp->u.string))) {
-				    fs.op = c;
-				    fs.name = valsp->u.string;
-				    if (c == OP_FILE) {
-					fs.rcode = stat(valsp->u.string,
-								&fs.stat);
-				    } else {
-					fs.rcode = lstat(valsp->u.string,
-								&fs.stat);
-				    }
-			      }
-			}
-			if (binary < FIRST_BINARY_OP)
-			      break;
-			binary = 0;
-		  }
-		  if (! skipping)
-			expr_operator(opsp->op, valsp, &fs);
-		  else if (opsp->op == AND1 || opsp->op == OR1)
-			skipping--;
-		  valsp++;		/* push value */
-		  opsp++;		/* pop operator */
-	    }
-	    if (opname == NULL)
-		  break;
-	    if (opsp == &opstack[0])
-		  goto overflow;
-	    if (op == AND1 || op == AND2) {
-		  op = AND1;
-		  if (skipping || expr_is_false(valsp - 1))
-			skipping++;
-	    }
-	    if (op == OR1 || op == OR2) {
-		  op = OR1;
-		  if (skipping || ! expr_is_false(valsp - 1))
-			skipping++;
-	    }
-	    opsp--;
-	    opsp->op = op;
-	    opsp->pri = pri;
-      }
-done:
-      if (print) {
-	    if (valstack[0].type == STRING)
-		  printf("%s\n", valstack[0].u.string);
-	    else if (valstack[0].type == INTEGER)
-		  printf("%ld\n", valstack[0].u.num);
-	    else if (valstack[0].u.num != 0)
-		  printf("true\n");
-      }
-      return expr_is_false(&valstack[0]);
-}
-
-
-int
-expr_is_false(val)
-      struct value *val;
-      {
-      if (val->type == STRING) {
-	    if (val->u.string[0] == '\0')
-		  return 1;
-      } else {	/* INTEGER or BOOLEAN */
-	    if (val->u.num == 0)
-		  return 1;
-      }
-      return 0;
-}
-
-
-/*
- * Execute an operator.  Op is the operator.  Sp is the stack pointer;
- * sp[0] refers to the first operand, sp[1] refers to the second operand
- * (if any), and the result is placed in sp[0].  The operands are converted
- * to the type expected by the operator before expr_operator is called.
- * Fs is a pointer to a structure which holds the value of the last call
- * to stat, to avoid repeated stat calls on the same file.
- */
-
-void
-expr_operator(op, sp, fs)
-      int op;
-      struct value *sp;
-      struct filestat *fs;
-      {
-      int i;
-      struct stat st1, st2;
-
-      switch (op) {
-      case NOT:
-	    sp->u.num = expr_is_false(sp);
-	    sp->type = BOOLEAN;
-	    break;
-      case ISREAD:
-	    i = 04;
-	    goto permission;
-      case ISWRITE:
-	    i = 02;
-	    goto permission;
-      case ISEXEC:
-	    i = 01;
-permission:
-	    if (fs->stat.st_uid == geteuid())
-		  i <<= 6;
-	    else if (fs->stat.st_gid == getegid())
-		  i <<= 3;
-	    goto filebit;	/* true if (stat.st_mode & i) != 0 */
-      case ISFILE:
-	    i = S_IFREG;
-	    goto filetype;
-      case ISDIR:
-	    i = S_IFDIR;
-	    goto filetype;
-      case ISCHAR:
-	    i = S_IFCHR;
-	    goto filetype;
-      case ISBLOCK:
-	    i = S_IFBLK;
-	    goto filetype;
-      case ISFIFO:
-#ifdef S_IFIFO
-	    i = S_IFIFO;
-	    goto filetype;
-#else
-	    goto false;
-#endif
-filetype:
-	    if ((fs->stat.st_mode & S_IFMT) == i && fs->rcode >= 0) {
-true:
-		  sp->u.num = 1;
-	    } else {
-false:
-		  sp->u.num = 0;
-	    }
-	    sp->type = BOOLEAN;
-	    break;
-      case ISSETUID:
-	    i = S_ISUID;
-	    goto filebit;
-      case ISSETGID:
-	    i = S_ISGID;
-	    goto filebit;
-      case ISSTICKY:
-	    i = S_ISVTX;
-filebit:
-	    if (fs->stat.st_mode & i && fs->rcode >= 0)
-		  goto true;
-	    goto false;
-      case ISSIZE:
-	    sp->u.num = fs->rcode >= 0? fs->stat.st_size : 0L;
-	    sp->type = INTEGER;
-	    break;
-      case ISLINK1:
-      case ISLINK2:
-	    if (S_ISLNK(fs->stat.st_mode) && fs->rcode >= 0)
-		  goto true;
-	    fs->op = OP_FILE;	/* not a symlink, so expect a -d or so next */
-	    goto false;
-      case NEWER:
-	    if (stat(sp->u.string, &st1) != 0) {
-		  sp->u.num = 0;
-	    } else if (stat((sp + 1)->u.string, &st2) != 0) {
-		  sp->u.num = 1;
-	    } else {
-		  sp->u.num = st1.st_mtime >= st2.st_mtime;
-	    }
-	    sp->type = INTEGER;
-	    break;
-      case ISTTY:
-	    sp->u.num = isatty(sp->u.num);
-	    sp->type = BOOLEAN;
-	    break;
-      case NULSTR:
-	    if (sp->u.string[0] == '\0')
-		  goto true;
-	    goto false;
-      case STRLEN:
-	    sp->u.num = strlen(sp->u.string);
-	    sp->type = INTEGER;
-	    break;
-      case OR1:
-      case AND1:
-	    /*
-	     * These operators are mostly handled by the parser.  If we
-	     * get here it means that both operands were evaluated, so
-	     * the value is the value of the second operand.
-	     */
-	    *sp = *(sp + 1);
-	    break;
-      case STREQ:
-      case STRNE:
-	    i = 0;
-	    if (equal(sp->u.string, (sp + 1)->u.string))
-		  i++;
-	    if (op == STRNE)
-		  i = 1 - i;
-	    sp->u.num = i;
-	    sp->type = BOOLEAN;
-	    break;
-      case EQ:
-	    if (sp->u.num == (sp + 1)->u.num)
-		  goto true;
-	    goto false;
-      case NE:
-	    if (sp->u.num != (sp + 1)->u.num)
-		  goto true;
-	    goto false;
-      case GT:
-	    if (sp->u.num > (sp + 1)->u.num)
-		  goto true;
-	    goto false;
-      case LT:
-	    if (sp->u.num < (sp + 1)->u.num)
-		  goto true;
-	    goto false;
-      case LE:
-	    if (sp->u.num <= (sp + 1)->u.num)
-		  goto true;
-	    goto false;
-      case GE:
-	    if (sp->u.num >= (sp + 1)->u.num)
-		  goto true;
-	    goto false;
-      case PLUS:
-	    sp->u.num += (sp + 1)->u.num;
-	    break;
-      case MINUS:
-	    sp->u.num -= (sp + 1)->u.num;
-	    break;
-      case TIMES:
-	    sp->u.num *= (sp + 1)->u.num;
-	    break;
-      case DIVIDE:
-	    if ((sp + 1)->u.num == 0)
-		  error("Division by zero");
-	    sp->u.num /= (sp + 1)->u.num;
-	    break;
-      case REM:
-	    if ((sp + 1)->u.num == 0)
-		  error("Division by zero");
-	    sp->u.num %= (sp + 1)->u.num;
-	    break;
-      case MATCHPAT:
-	    {
-		  char *pat;
-
-		  pat = re_compile((sp + 1)->u.string);
-		  if (re_match(pat, sp->u.string)) {
-			if (number_parens > 0) {
-			      sp->u.string = match_begin[1];
-			      sp->u.string[match_length[1]] = '\0';
-			} else {
-			      sp->u.num = match_length[0];
-			      sp->type = INTEGER;
-			}
-		  } else {
-			if (number_parens > 0) {
-			      sp->u.string[0] = '\0';
-			} else {
-			      sp->u.num = 0;
-			      sp->type = INTEGER;
-			}
-		  }
-	    }
-	    break;
-      }
-}
-
-
-int
-lookup_op(name, table)
-      char *name;
-      char *const*table;
-      {
-      register char *const*tp;
-      register char const *p;
-      char c = name[1];
-
-      for (tp = table ; (p = *tp) != NULL ; tp++) {
-	    if (p[1] == c && equal(p, name))
-		  return tp - table;
-      }
-      return -1;
-}
Index: trunk/minix/commands/ash/bltin/line.c
===================================================================
--- trunk/minix/commands/ash/bltin/line.c	(revision 9)
+++ 	(revision )
@@ -1,27 +1,0 @@
-/*
- * The line command.  Reads one line from the standard input and writes it
- * to the standard output.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#define main linecmd
-
-#include "bltin.h"
-
-
-main(argc, argv)  char **argv; {
-      char c;
-
-      for (;;) {
-	    if (read(0, &c, 1) != 1) {
-		  putchar('\n');
-		  return 1;
-	    }
-	    putchar(c);
-	    if (c == '\n')
-		  return 0;
-      }
-}
Index: trunk/minix/commands/ash/bltin/makefile.not
===================================================================
--- trunk/minix/commands/ash/bltin/makefile.not	(revision 9)
+++ 	(revision )
@@ -1,71 +1,0 @@
-# Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
-# This file is part of ash, which is distributed under the terms specified
-# by the Ash General Public License.  See the file named LICENSE.
-
-LIBFILES=catfcmd.o echocmd.o exprcmd.o linecmd.o nlechocmd.o\
-	operators.o regexp.o
-DEBUG=-g
-CFLAGS=$(DEBUG)
-#CC=gcc
-
-all:$P bltinlib.a catf echo expr line nlecho true umask
-
-bltinlib.a:$P $(LIBFILES)
-	ar rc $@ $(LIBFILES)
-
-catf: catf.c bltin.h ../shell.h ../error.h error.o stalloc.o
-	$(CC) $(CFLAGS) -o $@ catf.c error.o stalloc.o
-
-catfcmd.o: catf.c bltin.h ../shell.h ../error.h
-	$(CC) -DSHELL $(CFLAGS) -c catf.c
-	mv catf.o $@
-
-expr: expr.c bltin.h ../shell.h operators.h operators.o regexp.o error.o stalloc.o
-	$(CC) $(CFLAGS) -o $@ expr.c operators.o regexp.o error.o stalloc.o
-	-rm -f test '['
-	ln expr test
-	ln expr '['
-
-exprcmd.o: expr.c bltin.h ../shell.h operators.h
-	$(CC) -DSHELL $(CFLAGS) -c expr.c
-	mv expr.o $@
-
-operators.c operators.h: unary_op binary_op mkexpr
-	./mkexpr
-
-operators.o: ../shell.h operators.h
-
-regexp.o: bltin.h ../shell.h
-
-echo: echo.c bltin.h ../shell.h
-	$(CC) $(CFLAGS) -o $@ echo.c
-
-echocmd.o: echo.c bltin.h ../shell.h
-	$(CC) -DSHELL $(CFLAGS) -c echo.c
-	mv echo.o $@
-
-line: line.c bltin.h ../shell.h
-	$(CC) $(CFLAGS) -o $@ line.c
-
-linecmd.o: line.c bltin.h ../shell.h
-	$(CC) -DSHELL $(CFLAGS) -c line.c
-	mv line.o $@
-
-nlecho: nlecho.c bltin.h ../shell.h
-	$(CC) $(CFLAGS) -o $@ nlecho.c
-
-nlechocmd.o: nlecho.c bltin.h ../shell.h
-	$(CC) -DSHELL $(CFLAGS) -c nlecho.c
-	mv nlecho.o $@
-
-umask: umask.c bltin.h
-	$(CC) $(CFLAGS) -o $@ umask.c
-
-true:
-	> :
-	chmod 755 :
-	rm -f true
-	ln : true
-
-stalloc.o: ../shell.h
-
Index: trunk/minix/commands/ash/bltin/mkexpr
===================================================================
--- trunk/minix/commands/ash/bltin/mkexpr	(revision 9)
+++ 	(revision )
@@ -1,66 +1,0 @@
-# Copyright 1989 by Kenneth Almquist.  All rights reserved.
-#
-# This file is part of ash.  Ash is distributed under the terms specified
-# by the Ash General Public License.  See the file named LICENSE.
-
-# All calls to awk removed, because Minix bawk is deficient.  (kjb)
-
-exec > operators.h
-i=0
-sed -e '/^[^#]/!d' unary_op binary_op | while read line
-do
-	set -$- $line
-	echo "#define $1 $i"
-	i=`expr $i + 1`
-done
-echo
-echo "#define FIRST_BINARY_OP" `sed -e '/^[^#]/!d' unary_op | wc -l`
-echo '
-#define OP_INT 1		/* arguments to operator are integer */
-#define OP_STRING 2		/* arguments to operator are string */
-#define OP_FILE 3		/* argument is a file name */
-#define OP_LFILE 4		/* argument is a file name of a symlink? */
-
-extern char *const unary_op[];
-extern char *const binary_op[];
-extern const char op_priority[];
-extern const char op_argflag[];'
-
-exec > operators.c
-echo '/*
- * Operators used in the expr/test command.
- */
-
-#include "../shell.h"
-#include "operators.h"
-
-char *const unary_op[] = {'
-sed -e '/^[^#]/!d
-	s/[ 	][ 	]*/ /g
-	s/^[^ ][^ ]* \([^ ][^ ]*\).*/      "\1",/
-	' unary_op
-echo '      NULL
-};
-
-char *const binary_op[] = {'
-sed -e '/^[^#]/!d
-	s/[ 	][ 	]*/ /g
-	s/^[^ ][^ ]* \([^ ][^ ]*\).*/      "\1",/
-	' binary_op
-echo '      NULL
-};
-
-const char op_priority[] = {'
-sed -e '/^[^#]/!d
-	s/[ 	][ 	]*/ /g
-	s/^[^ ][^ ]* [^ ][^ ]* \([^ ][^ ]*\).*/      \1,/
-	' unary_op binary_op
-echo '};
-
-const char op_argflag[] = {'
-sed -e '/^[^#]/!d
-	s/[ 	][ 	]*/ /g
-	s/^[^ ][^ ]* [^ ][^ ]* [^ ][^ ]*$/& 0/
-	s/^[^ ][^ ]* [^ ][^ ]* [^ ][^ ]* \([^ ][^ ]*\)/      \1,/
-	' unary_op binary_op
-echo '};'
Index: trunk/minix/commands/ash/bltin/nlecho.c
===================================================================
--- trunk/minix/commands/ash/bltin/nlecho.c	(revision 9)
+++ 	(revision )
@@ -1,25 +1,0 @@
-/*
- * Echo the command argument to the standard output, one line at a time.
- * This command is useful for debugging th shell and whenever you what
- * to output strings literally.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-
-#define main nlechocmd
-
-#include "bltin.h"
-
-
-main(argc, argv)  char **argv; {
-      register char **ap;
-
-      for (ap = argv + 1 ; *ap ; ap++) {
-	    fputs(*ap, stdout);
-	    putchar('\n');
-      }
-      return 0;
-}
Index: trunk/minix/commands/ash/bltin/regexp.c
===================================================================
--- trunk/minix/commands/ash/bltin/regexp.c	(revision 9)
+++ 	(revision )
@@ -1,299 +1,0 @@
-/*
- * Regular expression matching for expr(1).  Bugs:  The upper bound of
- * a range specified by the \{ feature cannot be zero.
- *
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#include "bltin.h"
-
-
-#define RE_END 0		/* end of regular expression */
-#define RE_LITERAL 1		/* normal character follows */
-#define RE_DOT 2		/* "." */
-#define RE_CCL 3		/* "[...]" */
-#define RE_NCCL 4		/* "[^...]" */
-#define RE_LP 5			/* "\(" */
-#define RE_RP 6			/* "\)" */
-#define RE_MATCHED 7		/* "\digit" */
-#define RE_EOS 8		/* "$" matches end of string */
-#define RE_STAR 9		/* "*" */
-#define RE_RANGE 10		/* "\{num,num\}" */
-
-
-
-char *match_begin[10];
-short match_length[10];
-short number_parens;
-static int match();
-
-
-
-char *
-re_compile(pattern)
-	char *pattern;
-	{
-	register char *p;
-	register char c;
-	char *comp;
-	register char *q;
-	char *begin;
-	char *endp;
-	register int len;
-	int first;
-	int type;
-	char *stackp;
-	char stack[10];
-	int paren_num;
-	int i;
-	char *malloc();
-
-	p = pattern;
-	if (*p == '^')
-		p++;
-	comp = q = malloc(2 * strlen(p) + 1);
-	begin = q;
-	stackp = stack;
-	paren_num = 0;
-	for (;;) {
-		switch (c = *p++) {
-		case '\0':
-			*q = '\0';
-			goto out;
-		case '.':
-			*q++ = RE_DOT;
-			len = 1;
-			break;
-		case '[':
-			begin = q;
-			*q = RE_CCL;
-			if (*p == '^') {
-				*q = RE_NCCL;
-				p++;
-			}
-			q++;
-			first = 1;
-			while (*p != ']' || first == 1) {
-				if (p[1] == '-' && p[2] != ']') {
-					*q++ = '-';
-					*q++ = p[0];
-					*q++ = p[2];
-					p += 3;
-				} else if (*p == '-') {
-					*q++ = '-';
-					*q++ = '-';
-					*q++ = '-';
-					p++;
-				} else {
-					*q++ = *p++;
-				}
-				first = 0;
-			}
-			p++;
-			*q++ = '\0';
-			len = q - begin;
-			break;
-		case '$':
-			if (*p != '\0')
-				goto dft;
-			*q++ = RE_EOS;
-			break;
-		case '*':
-			if (len == 0)
-				goto dft;
-			type = RE_STAR;
-range:
-			i = (type == RE_RANGE)? 3 : 1;
-			endp = q + i;
-			begin = q - len;
-			do {
-				--q;
-				*(q + i) = *q;
-			} while (--len > 0);
-			q = begin;
-			*q++ = type;
-			if (type == RE_RANGE) {
-				i = 0;
-				while ((unsigned)(*p - '0') <= 9)
-					i = 10 * i + (*p++ - '0');
-				*q++ = i;
-				if (*p != ',') {
-					*q++ = i;
-				} else {
-					p++;
-					i = 0;
-					while ((unsigned)(*p - '0') <= 9)
-						i = 10 * i + (*p++ - '0');
-					*q++ = i;
-				}
-				if (*p != '\\' || *++p != '}')
-					error("RE error");
-				p++;
-			}
-			q = endp;
-			break;
-		case '\\':
-			if ((c = *p++) == '(') {
-				if (++paren_num > 9)
-					error("RE error");
-				*q++ = RE_LP;
-				*q++ = paren_num;
-				*stackp++ = paren_num;
-				len = 0;
-			} else if (c == ')') {
-				if (stackp == stack)
-					error("RE error");
-				*q++ = RE_RP;
-				*q++ = *--stackp;
-				len = 0;
-			} else if (c == '{') {
-				type = RE_RANGE;
-				goto range;
-			} else if ((unsigned)(c - '1') < 9) {
-				/* should check validity here */
-				*q++ = RE_MATCHED;
-				*q++ = c - '0';
-				len = 2;
-			} else {
-				goto dft;
-			}
-			break;
-		default:
-dft:			*q++ = RE_LITERAL;
-			*q++ = c;
-			len = 2;
-			break;
-		}
-	}
-out:
-	if (stackp != stack)
-		error("RE error");
-	number_parens = paren_num;
-	return comp;
-}
-
-
-
-re_match(pattern, string)
-	char *pattern;
-	char *string;
-	{
-	char **pp;
-
-	match_begin[0] = string;
-	for (pp = &match_begin[1] ; pp <= &match_begin[9] ; pp++)
-		*pp = 0;
-	return match(pattern, string);
-}
-
-
-
-static
-match(pattern, string)
-	char *pattern;
-	char *string;
-	{
-	register char *p, *q;
-	int counting;
-	int low, high, count;
-	char *curpat;
-	char *start_count;
-	int negate;
-	int found;
-	char *r;
-	int len;
-	char c;
-
-	p = pattern;
-	q = string;
-	counting = 0;
-	for (;;) {
-		if (counting) {
-			if (++count > high)
-				goto bad;
-			p = curpat;
-		}
-		switch (*p++) {
-		case RE_END:
-			match_length[0] = q - match_begin[0];
-			return 1;
-		case RE_LITERAL:
-			if (*q++ != *p++)
-				goto bad;
-			break;
-		case RE_DOT:
-			if (*q++ == '\0')
-				goto bad;
-			break;
-		case RE_CCL:
-			negate = 0;
-			goto ccl;
-		case RE_NCCL:
-			negate = 1;
-ccl:
-			found = 0;
-			c = *q++;
-			while (*p) {
-				if (*p == '-') {
-					if (c >= *++p && c <= *++p)
-						found = 1;
-				} else {
-					if (c == *p)
-						found = 1;
-				}
-				p++;
-			}
-			p++;
-			if (found == negate || c == 0)
-				goto bad;
-			break;
-		case RE_LP:
-			match_begin[*p++] = q;
-			break;
-		case RE_RP:
-			match_length[*p] = q - match_begin[*p];
-			p++;
-			break;
-		case RE_MATCHED:
-			r = match_begin[*p];
-			len = match_length[*p++];
-			while (--len >= 0) {
-				if (*q++ != *r++)
-					goto bad;
-			}
-			break;
-		case RE_EOS:
-			if (*q != '\0')
-				goto bad;
-			break;
-		case RE_STAR:
-			low = 0;
-			high = 32767;
-			goto range;
-		case RE_RANGE:
-			low = *p++;
-			high = *p++;
-			if (high == 0)
-				high = 32767;
-range:
-			curpat = p;
-			start_count = q;
-			count = 0;
-			counting++;
-			break;
-		}
-	}
-bad:
-	if (! counting)
-		return 0;
-	len = 1;
-	if (*curpat == RE_MATCHED)
-		len = match_length[curpat[1]];
-	while (--count >= low) {
-		if (match(p, start_count + count * len))
-			return 1;
-	}
-	return 0;
-}
Index: trunk/minix/commands/ash/bltin/stalloc.c
===================================================================
--- trunk/minix/commands/ash/bltin/stalloc.c	(revision 9)
+++ 	(revision )
@@ -1,21 +1,0 @@
-/*
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#include "../shell.h"
-
-
-void error();
-pointer malloc();
-
-
-pointer
-stalloc(nbytes) {
-      register pointer p;
-
-      if ((p = malloc(nbytes)) == NULL)
-	    error("Out of space");
-      return p;
-}
Index: trunk/minix/commands/ash/bltin/umask.c
===================================================================
--- trunk/minix/commands/ash/bltin/umask.c	(revision 9)
+++ 	(revision )
@@ -1,19 +1,0 @@
-/*
- * Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
- * This file is part of ash, which is distributed under the terms specified
- * by the Ash General Public License.  See the file named LICENSE.
- */
-
-#include <stdio.h>
-
-
-main(argc, argv)  char **argv; {
-      int mask;
-
-      if (argc > 1) {
-	    fprintf(stderr, "umask: only builtin version of umask can set value\n");
-	    exit(2);
-      }
-      printf("%.4o\n", umask(0));
-      return 0;
-}
Index: trunk/minix/commands/ash/bltin/unary_op
===================================================================
--- trunk/minix/commands/ash/bltin/unary_op	(revision 9)
+++ 	(revision )
@@ -1,24 +1,0 @@
-# List of unary operators used by test/expr.
-#
-# Copyright (C) 1989 by Kenneth Almquist.  All rights reserved.
-# This file is part of ash, which is distributed under the terms specified
-# by the Ash General Public License.  See the file named LICENSE.
-
-NOT	 !	3
-ISREAD	 -r	12   OP_FILE
-ISWRITE  -w	12   OP_FILE
-ISEXEC	 -x	12   OP_FILE
-ISFILE	 -f	12   OP_FILE
-ISDIR	 -d	12   OP_FILE
-ISCHAR	 -c	12   OP_FILE
-ISBLOCK	 -b	12   OP_FILE
-ISFIFO	 -p	12   OP_FILE
-ISSETUID -u	12   OP_FILE
-ISSETGID -g	12   OP_FILE
-ISSTICKY -k	12   OP_FILE
-ISSIZE	 -s	12   OP_FILE
-ISLINK1  -h	12   OP_LFILE
-ISLINK2  -L	12   OP_LFILE
-ISTTY	 -t	12   OP_INT
-NULSTR	 -z	12   OP_STRING
-STRLEN	 -n	12   OP_STRING
