oksh-noxz

[fork] Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh).
git clone https://noxz.tech/git/oksh-noxz.git
oksh-noxz

commit: 5e29a758b1ba8937fd252de04769c636129c469d
parent: 182d9fc45e4c5bc06b8e105d13207afa657ae3a7
author: Brian Callahan <bcallah@openbsd.org>
date:   Thu, 16 Dec 2021 15:58:29 -0500
Sync with OpenBSD.
MCVS/Entries68++++++++++----------
DCVS/Entries.Log2-
Memacs.c4+-
Mexec.c4+-
Mmisc.c4+-
Mtty.c4+-
6 files changed, 42 insertions(+), 44 deletions(-)
diff --git a/CVS/Entries b/CVS/Entries
@@ -1,46 +1,46 @@
 /config.h/1.19/Tue Jan 16 02:21:56 2018//
 /c_test.c/1.27/Result of merge//
 /edit.c/1.69/Result of merge//
-/exec.c/1.74/Result of merge//
 /main.c/1.98/Result of merge//
-/tty.c/1.18/Result of merge+Tue Jul 23 23:36:05 2019//
 /io.c/1.38/Result of merge//
 /history.c/1.84/Result of merge//
 /trap.c/1.33/Tue Dec 17 00:39:35 2019//
 /sh.h/1.76/Result of merge//
 /eval.c/1.66/Result of merge//
-/misc.c/1.76/Result of merge//
 /var.c/1.72/Result of merge//
 /vi.c/1.60/Result of merge+Fri Mar 12 03:48:27 2021//
-/Makefile/1.39/Sun Jun 27 18:11:13 2021//
-/emacs.c/1.88/Result of merge//
-/CONTRIBUTORS/1.11/Fri Aug 20 19:32:00 2021//
-/LEGAL/1.2/Fri Aug 20 19:32:00 2021//
-/NOTES/1.16/Fri Aug 20 19:32:00 2021//
-/PROJECTS/1.9/Fri Aug 20 19:32:00 2021//
-/README/1.16/Sat Sep  4 14:25:21 2021//
-/alloc.c/1.19/Fri Aug 20 19:32:00 2021//
-/c_ksh.c/1.62/Fri Aug 20 19:32:00 2021//
-/c_sh.c/1.64/Fri Aug 20 19:32:00 2021//
-/c_test.h/1.4/Fri Aug 20 19:32:00 2021//
-/c_ulimit.c/1.29/Fri Aug 20 19:32:00 2021//
-/edit.h/1.12/Fri Aug 20 19:32:00 2021//
-/expand.h/1.15/Fri Aug 20 19:32:00 2021//
-/expr.c/1.34/Fri Aug 20 19:32:00 2021//
-/jobs.c/1.62/Fri Aug 20 19:32:00 2021//
-/ksh.1/1.215/Fri Aug 20 19:32:00 2021//
-/lex.c/1.78/Fri Aug 20 19:32:00 2021//
-/lex.h/1.21/Fri Aug 20 19:32:00 2021//
-/mail.c/1.27/Fri Aug 20 19:32:00 2021//
-/path.c/1.23/Fri Aug 20 19:32:00 2021//
-/sh.1/1.153/Fri Aug 20 19:32:00 2021//
-/shf.c/1.34/Fri Aug 20 19:32:00 2021//
-/shf.h/1.8/Fri Aug 20 19:32:00 2021//
-/table.c/1.25/Fri Aug 20 19:32:00 2021//
-/table.h/1.15/Fri Aug 20 19:32:00 2021//
-/tree.c/1.34/Fri Aug 20 19:32:00 2021//
-/tree.h/1.12/Fri Aug 20 19:32:00 2021//
-/tty.h/1.6/Fri Aug 20 19:32:00 2021//
-/version.c/1.12/Fri Aug 20 19:32:00 2021//
-/syn.c/1.40/Sat Sep  4 14:25:21 2021//
+/CONTRIBUTORS/1.11/Thu Dec 16 20:56:49 2021//
+/LEGAL/1.2/Thu Dec 16 20:56:49 2021//
+/Makefile/1.39/Thu Dec 16 20:56:58 2021//
+/NOTES/1.16/Thu Dec 16 20:56:49 2021//
+/PROJECTS/1.9/Thu Dec 16 20:56:49 2021//
+/README/1.16/Thu Dec 16 20:56:58 2021//
+/alloc.c/1.19/Thu Dec 16 20:56:49 2021//
+/c_ksh.c/1.62/Thu Dec 16 20:56:49 2021//
+/c_sh.c/1.64/Thu Dec 16 20:56:49 2021//
+/c_test.h/1.4/Thu Dec 16 20:56:49 2021//
+/c_ulimit.c/1.29/Thu Dec 16 20:56:49 2021//
+/edit.h/1.12/Thu Dec 16 20:56:49 2021//
+/emacs.c/1.89/Result of merge//
+/exec.c/1.75/Result of merge//
+/expand.h/1.15/Thu Dec 16 20:56:49 2021//
+/expr.c/1.34/Thu Dec 16 20:56:49 2021//
+/jobs.c/1.62/Thu Dec 16 20:56:49 2021//
+/ksh.1/1.215/Thu Dec 16 20:56:49 2021//
+/lex.c/1.78/Thu Dec 16 20:56:49 2021//
+/lex.h/1.21/Thu Dec 16 20:56:49 2021//
+/mail.c/1.27/Thu Dec 16 20:56:49 2021//
+/misc.c/1.77/Result of merge//
+/path.c/1.23/Thu Dec 16 20:56:49 2021//
+/sh.1/1.153/Thu Dec 16 20:56:49 2021//
+/shf.c/1.34/Thu Dec 16 20:56:49 2021//
+/shf.h/1.8/Thu Dec 16 20:56:49 2021//
+/syn.c/1.40/Thu Dec 16 20:56:49 2021//
+/table.c/1.25/Thu Dec 16 20:56:49 2021//
+/table.h/1.15/Thu Dec 16 20:56:49 2021//
+/tree.c/1.34/Thu Dec 16 20:56:49 2021//
+/tree.h/1.12/Thu Dec 16 20:56:49 2021//
+/tty.c/1.19/Result of merge//
+/tty.h/1.6/Thu Dec 16 20:56:49 2021//
+/version.c/1.12/Thu Dec 16 20:56:49 2021//
 D
diff --git a/CVS/Entries.Log b/CVS/Entries.Log
@@ -1,2 +0,0 @@
-A D/tests////
-R D/tests////
diff --git a/emacs.c b/emacs.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: emacs.c,v 1.88 2021/06/27 15:53:33 schwarze Exp $	*/
+/*	$OpenBSD: emacs.c,v 1.89 2021/10/09 21:38:00 halex Exp $	*/
 
 /*
  *  Emacs-like command line editing and history
@@ -905,7 +905,7 @@ x_search_hist(int c)
 		if ((c = x_e_getc()) < 0)
 			return KSTD;
 		f = kb_find_hist_func(c);
-		if (c == CTRL('[')) {
+		if (c == CTRL('[') || c == CTRL('@')) {
 			x_e_ungetc(c);
 			break;
 		} else if (f == x_search_hist)
diff --git a/exec.c b/exec.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: exec.c,v 1.74 2019/06/28 13:34:59 deraadt Exp $	*/
+/*	$OpenBSD: exec.c,v 1.75 2021/10/24 21:24:21 deraadt Exp $	*/
 
 /*
  * execute command tree
@@ -1197,7 +1197,7 @@ herein(const char *content, int sub)
 	 * doesn't get removed too soon).
 	 */
 	h = maketemp(ATEMP, TT_HEREDOC_EXP, &genv->temps);
-	if (!(shf = h->shf) || (fd = open(h->name, O_RDONLY, 0)) == -1) {
+	if (!(shf = h->shf) || (fd = open(h->name, O_RDONLY)) == -1) {
 		warningf(true, "can't %s temporary file %s: %s",
 		    !shf ? "create" : "open",
 		    h->name, strerror(errno));
diff --git a/misc.c b/misc.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: misc.c,v 1.76 2020/10/26 18:16:51 tb Exp $	*/
+/*	$OpenBSD: misc.c,v 1.77 2021/12/15 04:01:52 deraadt Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -1138,7 +1138,7 @@ ksh_get_wd(char *buf, int bsize)
 	/* Assume getcwd() available */
 	if (!buf) {
 		bsize = PATH_MAX;
-		b = alloc(PATH_MAX + 1, ATEMP);
+		b = alloc(bsize, ATEMP);
 	} else
 		b = buf;
 
diff --git a/tty.c b/tty.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: tty.c,v 1.18 2019/06/28 13:34:59 deraadt Exp $	*/
+/*	$OpenBSD: tty.c,v 1.19 2021/10/24 21:24:21 deraadt Exp $	*/
 
 #include <errno.h>
 #include <fcntl.h>
@@ -33,7 +33,7 @@ tty_init(int init_ttystate)
 	tty_close();
 	tty_devtty = 1;
 
-	tfd = open("/dev/tty", O_RDWR, 0);
+	tfd = open("/dev/tty", O_RDWR);
 	if (tfd == -1) {
 		tty_devtty = 0;
 		warningf(false, "No controlling tty (open /dev/tty: %s)",