diff options
author | joerg <joerg@FreeBSD.org> | 1995-08-27 20:26:44 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-08-27 20:26:44 +0000 |
commit | 3de11c3b09cdec723b035bb30b7c9dd56e6a63fe (patch) | |
tree | aa25560c1b49997e050627ed8fb344509e6d8e8e | |
parent | 036808c79be581b38c4def1672d9fe425496c53b (diff) | |
download | FreeBSD-src-3de11c3b09cdec723b035bb30b7c9dd56e6a63fe.zip FreeBSD-src-3de11c3b09cdec723b035bb30b7c9dd56e6a63fe.tar.gz |
Make the shell handle a null command in a &&/|| sequence correctly.
The && and || tokens do also terminate a command, not only the
newline.
While i was at it, disabled trace code by default, it served no good
purpose since it required the use of a debugger anyway to be turned
on. Instead, placed a hint in the Makefile on how to turn it on.
This makes the shell ~ 10 % faster and ~ 4 KB smaller. :)
Pointed out by: jan@physik.TU-Berlin.DE (Jan Riedinger)
-rw-r--r-- | bin/sh/Makefile | 4 | ||||
-rw-r--r-- | bin/sh/parser.c | 4 | ||||
-rw-r--r-- | bin/sh/shell.h | 4 |
3 files changed, 8 insertions, 4 deletions
diff --git a/bin/sh/Makefile b/bin/sh/Makefile index 1d00e1a..ae285c97 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -1,5 +1,5 @@ # @(#)Makefile 8.1 (Berkeley) 6/8/93 -# $Id: Makefile,v 1.6 1994/09/24 02:57:18 davidg Exp $ +# $Id: Makefile,v 1.7 1994/10/02 01:36:03 ache Exp $ PROG= sh SRCS= alias.c builtins.c cd.c echo.c error.c eval.c exec.c expand.c \ @@ -11,6 +11,8 @@ DPADD= ${LIBL} ${LIBEDIT} ${LIBTERMCAP} LDADD= -ll -ledit -ltermcap LFLAGS= -8 # 8-bit lex scanner for arithmetic CFLAGS+=-DSHELL -I. -I${.CURDIR} +# for debugging: +#CFLAGS+=-g -DDEBUG=2 .PATH: ${.CURDIR}/bltin ${.CURDIR}/../../usr.bin/printf CLEANFILES+=\ builtins.c builtins.h init.c mkinit mknodes mksignames mksyntax \ diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 1353b5b..83830ec 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: parser.c,v 1.6 1995/05/30 00:07:22 rgrimes Exp $ + * $Id: parser.c,v 1.7 1995/08/11 08:18:39 joerg Exp $ */ #ifndef lint @@ -442,6 +442,8 @@ TRACE(("expecting DO got %s %s\n", tokname[got], got == TWORD ? wordtext : "")); checkkwd = 1; break; /* Handle an empty command like other simple commands. */ + case TAND: + case TOR: case TNL: case TWORD: tokpushback++; diff --git a/bin/sh/shell.h b/bin/sh/shell.h index ec49ef9..d038f91 100644 --- a/bin/sh/shell.h +++ b/bin/sh/shell.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)shell.h 8.1 (Berkeley) 5/31/93 - * $Id$ + * $Id: shell.h,v 1.2 1994/09/24 02:58:15 davidg Exp $ */ /* @@ -57,7 +57,7 @@ #ifndef BSD #define BSD 1 #endif -#define DEBUG 1 +/* #define DEBUG 1 */ #ifdef __STDC__ typedef void *pointer; |