about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-08 11:02:23 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-08 11:02:23 +0000
commita1e0eed861cf18b043107f50823a9a498347d89f (patch)
tree595098ab9f219d746d9a68f4ed0e95ac12289d83 /Src
parente49689cba8168ee0c9c1bb8184f207f76583e629 (diff)
downloadzsh-a1e0eed861cf18b043107f50823a9a498347d89f.tar.gz
zsh-a1e0eed861cf18b043107f50823a9a498347d89f.tar.xz
zsh-a1e0eed861cf18b043107f50823a9a498347d89f.zip
zsh-workers/9617
Diffstat (limited to 'Src')
-rw-r--r--Src/exec.c9
-rw-r--r--Src/init.c13
-rw-r--r--Src/options.c2
-rw-r--r--Src/zsh.h2
4 files changed, 13 insertions, 13 deletions
diff --git a/Src/exec.c b/Src/exec.c
index fb73e124e..7b45a1ba2 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1661,11 +1661,16 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		    } else if (varspc) {
 			nullexec = 2;
 			break;
-		    } else if (!nullcmd || !*nullcmd ||
-			       (cflags & BINF_PREFIX)) {
+		    } else if (((!nullcmd || !*nullcmd || opts[IGNORENULLCMD])
+				&& !opts[SHNULLCMD]) 
+			       ||(cflags & BINF_PREFIX)) {
 			zerr("redirection with no command", NULL, 0);
 			errflag = lastval = 1;
 			return;
+		    } else if (!nullcmd || !*nullcmd || opts[IGNORENULLCMD]) {
+			if (!args)
+			    args = newlinklist();
+			addlinknode(args, dupstring(":"));
 		    } else if (readnullcmd && *readnullcmd &&
 			       ((Redir) peekfirst(redir))->type == READ &&
 			       !nextnode(firstnode(redir))) {
diff --git a/Src/init.c b/Src/init.c
index efb4ce778..d3b52845f 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -659,17 +659,8 @@ setupvals(void)
     mypid = (zlong) getpid();
     term  = ztrdup("");
 
-    /* The following variable assignments cause zsh to behave more *
-     * like Bourne and Korn shells when invoked as "sh" or "ksh".  *
-     * NULLCMD=":" and READNULLCMD=":"                             */
-
-    if (emulation == EMULATE_KSH || emulation == EMULATE_SH) {
-	nullcmd     = ztrdup(":");
-	readnullcmd = ztrdup(":");
-    } else {
-	nullcmd     = ztrdup("cat");
-	readnullcmd = ztrdup("more");
-    }
+    nullcmd     = ztrdup("cat");
+    readnullcmd = ztrdup("more");
 
     /* We cache the uid so we know when to *
      * recheck the info for `USERNAME'     */
diff --git a/Src/options.c b/Src/options.c
index 1beee4b95..3d657edcb 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -134,6 +134,7 @@ static struct optname optns[] = {
 {NULL, "hup",		      OPT_EMULATE|OPT_ZSH,	 HUP},
 {NULL, "ignorebraces",	      OPT_EMULATE|OPT_SH,	 IGNOREBRACES},
 {NULL, "ignoreeof",	      0,			 IGNOREEOF},
+{NULL, "ignorenullcmd",	      OPT_EMULATE|OPT_NONZSH,	 IGNORENULLCMD},
 {NULL, "incappendhistory",    0,			 INCAPPENDHISTORY},
 {NULL, "interactive",	      OPT_SPECIAL,		 INTERACTIVE},
 {NULL, "interactivecomments", OPT_BOURNE,		 INTERACTIVECOMMENTS},
@@ -185,6 +186,7 @@ static struct optname optns[] = {
 {NULL, "shfileexpansion",     OPT_EMULATE|OPT_BOURNE,	 SHFILEEXPANSION},
 {NULL, "shglob",	      OPT_EMULATE|OPT_BOURNE,	 SHGLOB},
 {NULL, "shinstdin",	      OPT_SPECIAL,		 SHINSTDIN},
+{NULL, "shnullcmd",           OPT_EMULATE|OPT_BOURNE,	 SHNULLCMD},
 {NULL, "shoptionletters",     OPT_EMULATE|OPT_BOURNE,	 SHOPTIONLETTERS},
 {NULL, "shortloops",	      OPT_EMULATE|OPT_NONBOURNE, SHORTLOOPS},
 {NULL, "shwordsplit",	      OPT_EMULATE|OPT_BOURNE,	 SHWORDSPLIT},
diff --git a/Src/zsh.h b/Src/zsh.h
index 15b01a0db..9dc7f2087 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1301,6 +1301,7 @@ enum {
     HUP,
     IGNOREBRACES,
     IGNOREEOF,
+    IGNORENULLCMD,
     INCAPPENDHISTORY,
     INTERACTIVE,
     INTERACTIVECOMMENTS,
@@ -1352,6 +1353,7 @@ enum {
     SHFILEEXPANSION,
     SHGLOB,
     SHINSTDIN,
+    SHNULLCMD,
     SHOPTIONLETTERS,
     SHORTLOOPS,
     SHWORDSPLIT,