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)
This commit is contained in:
Joerg Wunsch 1995-08-27 20:26:44 +00:00
parent 0f700bfda2
commit 47a052e00f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10354
3 changed files with 8 additions and 4 deletions

View File

@ -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 \

View File

@ -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++;

View File

@ -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;