CVS commit: src/bin/ksh

2021-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 23 01:31:30 UTC 2021

Modified Files:
src/bin/ksh: siglist.sh

Log Message:
PR/56007: Greg A. Woods: ksh unable to execute ERR traps
(probably since 2016/03/17 - i.e. 8.x and 9.x)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/siglist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/siglist.sh
diff -u src/bin/ksh/siglist.sh:1.12 src/bin/ksh/siglist.sh:1.13
--- src/bin/ksh/siglist.sh:1.12	Thu Mar 17 09:59:02 2016
+++ src/bin/ksh/siglist.sh	Mon Feb 22 20:31:30 2021
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: siglist.sh,v 1.12 2016/03/17 13:59:02 christos Exp $
+#	$NetBSD: siglist.sh,v 1.13 2021/02/23 01:31:30 christos Exp $
 #
 # Script to generate a sorted, complete list of signals, suitable
 # for inclusion in trap.c as array initializer.
@@ -21,16 +21,17 @@ CPP="${1-cc -E}"
 # The trap here to make up for a bug in bash (1.14.3(1)) that calls the trap
 (trap $trapsigs;
  echo '#include "sh.h"';
- echo '	{ QwErTy SIGNALS , "DUMMY" , "hook for number of signals" },';
+ echo ' { QwErTy /* dummy for sed sillies */ },';
  ${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
 	{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
 #endif/') > $in
-# work around for gcc 5
+echo '	{ QwErTy .signal = SIGNALS , .name = "DUMMY", .mess = "hook to expand array to total signals" },' >> $in
+# work around for gcc > 5
 $CPP $in | grep -v '^#' | tr -d '\n' | ${SED} 's/},/},\
 /g' > $out
 ${SED} -n 's/{ QwErTy/{/p' < $out | ${AWK} '{print NR, $0}' | sort -k 5n -k 1n |
-${SED} 's/^[0-9]* //' |
-${AWK} 'BEGIN { last=0; nsigs=0; }
+${SED} -E -e 's/^[0-9]* //' -e 's/ +/ /' |
+${AWK} 'BEGIN { last=0; }
 	{
 	if ($4 ~ /^[0-9][0-9]*$/ && $5 == ",") {
 		n = $4;



CVS commit: src/bin/ksh

2018-08-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sun Aug 26 22:52:34 UTC 2018

Modified Files:
src/bin/ksh: ksh.Man

Log Message:
Add -l to SYNOPSIS


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/ksh.Man

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/ksh.Man
diff -u src/bin/ksh/ksh.Man:1.25 src/bin/ksh/ksh.Man:1.26
--- src/bin/ksh/ksh.Man:1.25	Wed Dec 30 22:26:26 2015
+++ src/bin/ksh/ksh.Man	Sun Aug 26 22:52:34 2018
@@ -1,5 +1,5 @@
 '\" t
-.\" $NetBSD: ksh.Man,v 1.25 2015/12/30 22:26:26 christos Exp $
+.\" $NetBSD: ksh.Man,v 1.26 2018/08/26 22:52:34 sevan Exp $
 .\"{{{}}}
 .\"{{{  Notes about man page
 .\" - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
@@ -19,10 +19,10 @@
 .\"}}}
 .\"{{{  Title
 .ksh(
-.TH KSH 1 "April 12, 2015" "" "User commands"
+.TH KSH 1 "August 26, 2018" "" "User commands"
 .ksh)
 .sh(
-.TH SH 1 "April 12, 2015" "" "User commands"
+.TH SH 1 "August 26, 2018" "" "User commands"
 .sh)
 .\"}}}
 .\"{{{  Name
@@ -43,7 +43,7 @@ sh \- Public domain Bourne shell
 .sh(
 \fBsh\fP
 .sh)
-[\fB\(+-abCefhikmnprsuvxX\fP] [\fB\(+-o\fP \fIoption\fP] [ [ \fB\-c\fP \fIcommand-string\fP [\fIcommand-name\fP] | \fB\-s\fP | \fIfile\fP ] [\fIargument\fP ...] ]
+[\fB\(+-abCefhiklmnprsuvxX\fP] [\fB\(+-o\fP \fIoption\fP] [ [ \fB\-c\fP \fIcommand-string\fP [\fIcommand-name\fP] | \fB\-s\fP | \fIfile\fP ] [\fIargument\fP ...] ]
 .ad b
 .\"}}}
 .\"{{{  Description



CVS commit: src/bin/ksh

2018-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 12 14:13:55 UTC 2018

Modified Files:
src/bin/ksh: eval.c

Log Message:
Change typ of tilde_ok from int to unsigned int in ksh(1)

UBSan can detect that during switching a login to root there is unportable
left shift operation:

$ su -
Password:
/public/src.git/bin/ksh/eval.c:598:13: runtime error: left shift of 1073741824 
by 1 places cannot be represented in type 'int'
#

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.24 src/bin/ksh/eval.c:1.25
--- src/bin/ksh/eval.c:1.24	Sun Jun  3 16:09:31 2018
+++ src/bin/ksh/eval.c	Tue Jun 12 14:13:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.24 2018/06/03 16:09:31 kamil Exp $	*/
+/*	$NetBSD: eval.c,v 1.25 2018/06/12 14:13:55 kamil Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.24 2018/06/03 16:09:31 kamil Exp $");
+__RCSID("$NetBSD: eval.c,v 1.25 2018/06/12 14:13:55 kamil Exp $");
 #endif
 
 #include 
@@ -173,7 +173,8 @@ expand(cp, wp, f)
 	Expand x;		/* expansion variables */
 	SubType st_head, *st;
 	int UNINITIALIZED(newlines); /* For trailing newlines in COMSUB */
-	int saw_eq, tilde_ok;
+	int saw_eq;
+	unsigned int tilde_ok;
 	int make_magic;
 	size_t len;
 



CVS commit: src/bin/ksh

2018-06-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun  3 16:09:31 UTC 2018

Modified Files:
src/bin/ksh: eval.c

Log Message:
ksh: Remove symbol clash with libc

Rename local function glob() to ksh_glob().
This is needed for installing interceptors in sanitizers.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.23 src/bin/ksh/eval.c:1.24
--- src/bin/ksh/eval.c:1.23	Tue May  8 16:37:59 2018
+++ src/bin/ksh/eval.c	Sun Jun  3 16:09:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.23 2018/05/08 16:37:59 kamil Exp $	*/
+/*	$NetBSD: eval.c,v 1.24 2018/06/03 16:09:31 kamil Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.23 2018/05/08 16:37:59 kamil Exp $");
+__RCSID("$NetBSD: eval.c,v 1.24 2018/06/03 16:09:31 kamil Exp $");
 #endif
 
 #include 
@@ -50,7 +50,7 @@ typedef struct Expand {
 static	int	varsub ARGS((Expand *xp, char *sp, char *word, int *stypep, int *slenp));
 static	int	comsub ARGS((Expand *xp, char *cp));
 static	char   *trimsub ARGS((char *str, char *pat, int how));
-static	void	glob ARGS((char *cp, XPtrV *wp, int markdirs));
+static	void	ksh_glob ARGS((char *cp, XPtrV *wp, int markdirs));
 static	void	globit ARGS((XString *xs, char **xpp, char *sp, XPtrV *wp,
 			 int check));
 static char	*maybe_expand_tilde ARGS((char *p, XString *dsp, char **dpp,
@@ -578,7 +578,7 @@ expand(cp, wp, f)
 else
 #endif /* BRACE_EXPAND */
 if (fdo & DOGLOB)
-	glob(p, wp, f & DOMARKDIRS);
+	ksh_glob(p, wp, f & DOMARKDIRS);
 else if ((f & DOPAT) || !(fdo & DOMAGIC_))
 	XPput(*wp, p);
 else
@@ -945,13 +945,13 @@ trimsub(str, pat, how)
 }
 
 /*
- * glob
+ * ksh_glob
  * Name derived from V6's /etc/glob, the program that expanded filenames.
  */
 
 /* XXX cp not const 'cause slashes are temporarily replaced with nulls... */
 static void
-glob(cp, wp, markdirs)
+ksh_glob(cp, wp, markdirs)
 	char *cp;
 	XPtrV *wp;
 	int markdirs;
@@ -1340,7 +1340,7 @@ alt_expand(wp, start, exp_start, end, fd
 		 * expansion. }
 		 */
 		if (fdo & DOGLOB)
-			glob(start, wp, fdo & DOMARKDIRS);
+			ksh_glob(start, wp, fdo & DOMARKDIRS);
 		else
 			XPput(*wp, debunk(start, start, end - start));
 		return;



CVS commit: src/bin/ksh

2018-06-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Jun  3 12:18:29 UTC 2018

Modified Files:
src/bin/ksh: c_ksh.c edit.c exec.c proto.h table.c table.h

Log Message:
ksh: Remove symbol clash with libc

Rename local function twalk() to ksh_twak().
This is needed for installing interceptors in sanitizers.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.34 -r1.35 src/bin/ksh/edit.c
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/exec.c
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/proto.h
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/table.c
cvs rdiff -u -r1.3 -r1.4 src/bin/ksh/table.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.28 src/bin/ksh/c_ksh.c:1.29
--- src/bin/ksh/c_ksh.c:1.28	Tue May  8 16:37:59 2018
+++ src/bin/ksh/c_ksh.c	Sun Jun  3 12:18:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.28 2018/05/08 16:37:59 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.29 2018/06/03 12:18:29 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.28 2018/05/08 16:37:59 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.29 2018/06/03 12:18:29 kamil Exp $");
 #endif
 
 #include 
@@ -1032,7 +1032,7 @@ c_unalias(wp)
 	if (all) {
 		struct tstate ts;
 
-		for (twalk(, t); (ap = tnext()); ) {
+		for (ksh_twalk(, t); (ap = tnext()); ) {
 			if (ap->flag) {
 ap->flag &= ~(ALLOC|ISSET);
 afree((void*)ap->val.s, APERM);

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.34 src/bin/ksh/edit.c:1.35
--- src/bin/ksh/edit.c:1.34	Sat Jul  1 23:12:08 2017
+++ src/bin/ksh/edit.c	Sun Jun  3 12:18:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.34 2017/07/01 23:12:08 joerg Exp $	*/
+/*	$NetBSD: edit.c,v 1.35 2018/06/03 12:18:29 kamil Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.34 2017/07/01 23:12:08 joerg Exp $");
+__RCSID("$NetBSD: edit.c,v 1.35 2018/06/03 12:18:29 kamil Exp $");
 #endif
 
 #include 
@@ -938,7 +938,7 @@ glob_table(pat, wp, tp)
 	struct tstate ts;
 	struct tbl *te;
 
-	for (twalk(, tp); (te = tnext()); ) {
+	for (ksh_twalk(, tp); (te = tnext()); ) {
 		if (gmatch(te->name, pat, false))
 			XPput(*wp, str_save(te->name, ATEMP));
 	}

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.27 src/bin/ksh/exec.c:1.28
--- src/bin/ksh/exec.c:1.27	Tue May  8 16:37:59 2018
+++ src/bin/ksh/exec.c	Sun Jun  3 12:18:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.27 2018/05/08 16:37:59 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.28 2018/06/03 12:18:29 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.27 2018/05/08 16:37:59 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.28 2018/06/03 12:18:29 kamil Exp $");
 #endif
 
 #include 
@@ -999,7 +999,7 @@ flushcom(all)
 	struct tbl *tp;
 	struct tstate ts;
 
-	for (twalk(, ); (tp = tnext()) != NULL; )
+	for (ksh_twalk(, ); (tp = tnext()) != NULL; )
 		if ((tp->flag) && (all || !ISDIRSEP(tp->val.s[0]))) {
 			if (tp->flag) {
 tp->flag &= ~(ALLOC|ISSET);

Index: src/bin/ksh/proto.h
diff -u src/bin/ksh/proto.h:1.12 src/bin/ksh/proto.h:1.13
--- src/bin/ksh/proto.h:1.12	Wed Jan 24 09:53:21 2018
+++ src/bin/ksh/proto.h	Sun Jun  3 12:18:29 2018
@@ -1,9 +1,9 @@
-/*	$NetBSD: proto.h,v 1.12 2018/01/24 09:53:21 kamil Exp $	*/
+/*	$NetBSD: proto.h,v 1.13 2018/06/03 12:18:29 kamil Exp $	*/
 
 /*
  * prototypes for PD-KSH
  * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang "
- * $Id: proto.h,v 1.12 2018/01/24 09:53:21 kamil Exp $
+ * $Id: proto.h,v 1.13 2018/06/03 12:18:29 kamil Exp $
  */
 
 #include 
@@ -219,7 +219,7 @@ void 	tinit		ARGS((struct table *, Area 
 struct tbl *	mytsearch	ARGS((struct table *, const char *, unsigned int));
 struct tbl *	tenter	ARGS((struct table *, const char *, unsigned int));
 void 	mytdelete		ARGS((struct tbl *));
-void 	twalk		ARGS((struct tstate *, struct table *));
+void 	ksh_twalk		ARGS((struct tstate *, struct table *));
 struct tbl *	tnext	ARGS((struct tstate *));
 struct tbl **	tsort	ARGS((struct table *));
 /* trace.c */

Index: src/bin/ksh/table.c
diff -u src/bin/ksh/table.c:1.7 src/bin/ksh/table.c:1.8
--- src/bin/ksh/table.c:1.7	Tue May  8 16:37:59 2018
+++ src/bin/ksh/table.c	Sun Jun  3 12:18:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: table.c,v 1.7 2018/05/08 16:37:59 kamil Exp $	*/
+/*	$NetBSD: table.c,v 1.8 2018/06/03 12:18:29 kamil Exp $	*/
 
 /*
  * dynamic hashed associative table for commands and variables
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: table.c,v 1.7 2018/05/08 16:37:59 kamil Exp $");
+__RCSID("$NetBSD: table.c,v 1.8 2018/06/03 12:18:29 kamil Exp $");
 #endif
 
 
@@ -151,7 +151,7 @@ mytdelete(p)
 }
 
 void
-twalk(ts, tp)
+ksh_twalk(ts, tp)
 	struct tstate *ts;
 	struct table *tp;
 {
@@ 

CVS commit: src/bin/ksh

2018-05-08 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May  8 16:37:59 UTC 2018

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c emacs.c eval.c exec.c expand.h expr.c
history.c io.c lex.c mail.c main.c misc.c syn.c table.c trap.c
tree.c var.c vi.c

Log Message:
Stop using the register keyword in ksh(1)

ksh also does some strange things with it, like put it in argument lists.

No functional change intended.

PR bin/53237 ksh: remove register keyword by Nia Alarie


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/c_sh.c src/bin/ksh/misc.c \
src/bin/ksh/var.c
cvs rdiff -u -r1.37 -r1.38 src/bin/ksh/emacs.c
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/eval.c src/bin/ksh/lex.c \
src/bin/ksh/main.c
cvs rdiff -u -r1.26 -r1.27 src/bin/ksh/exec.c
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/expand.h src/bin/ksh/table.c
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/expr.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/history.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/io.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/mail.c src/bin/ksh/tree.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/syn.c
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/trap.c
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.27 src/bin/ksh/c_ksh.c:1.28
--- src/bin/ksh/c_ksh.c:1.27	Wed Jan 24 09:53:20 2018
+++ src/bin/ksh/c_ksh.c	Tue May  8 16:37:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.27 2018/01/24 09:53:20 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.28 2018/05/08 16:37:59 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.27 2018/01/24 09:53:20 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.28 2018/05/08 16:37:59 kamil Exp $");
 #endif
 
 #include 
@@ -317,7 +317,7 @@ c_print(wp)
 	Xinit(xs, xp, 128, ATEMP);
 
 	while (*wp != NULL) {
-		register int c;
+		int c;
 		s = *wp;
 		while ((c = *s++) != '\0') {
 			Xcheck(xs, xp);
@@ -995,8 +995,8 @@ int
 c_unalias(wp)
 	char **wp;
 {
-	register struct table *t = 
-	register struct tbl *ap;
+	struct table *t = 
+	struct tbl *ap;
 	int rv = 0, all = 0;
 	int optc;
 
@@ -1389,7 +1389,7 @@ c_bind(wp)
 	char **wp;
 {
 	int rv = 0, macro = 0, list = 0;
-	register char *cp;
+	char *cp;
 	int optc;
 
 	while ((optc = ksh_getopt(wp, _opt, "lm")) != EOF)

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.23 src/bin/ksh/c_sh.c:1.24
--- src/bin/ksh/c_sh.c:1.23	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/c_sh.c	Tue May  8 16:37:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.24 2018/05/08 16:37:59 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.24 2018/05/08 16:37:59 kamil Exp $");
 #endif
 
 #include 
@@ -31,8 +31,8 @@ int
 c_shift(wp)
 	char **wp;
 {
-	register struct block *l = e->loc;
-	register int n;
+	struct block *l = e->loc;
+	int n;
 	long val;
 	char *arg;
 
@@ -63,8 +63,8 @@ int
 c_umask(wp)
 	char **wp;
 {
-	register int i;
-	register char *cp;
+	int i;
+	char *cp;
 	int symbolic = 0;
 	int old_umask;
 	int optc;
@@ -245,11 +245,11 @@ int
 c_read(wp)
 	char **wp;
 {
-	register int c = 0;
+	int c = 0;
 	int expandv = 1, history = 0;
 	int expanding;
 	int ecode = 0;
-	register char *cp;
+	char *cp;
 	int fd = 0;
 	struct shf *shf;
 	int optc;
@@ -429,7 +429,7 @@ int
 c_eval(wp)
 	char **wp;
 {
-	register struct source *s;
+	struct source *s;
 	int rv;
 
 	if (ksh_getopt(wp, _opt, null) == '?')
@@ -475,7 +475,7 @@ c_trap(wp)
 {
 	int i;
 	char *s;
-	register Trap *p;
+	Trap *p;
 
 	if (ksh_getopt(wp, _opt, null) == '?')
 		return 1;
@@ -635,7 +635,7 @@ c_set(wp)
 {
 	int argi, setargs;
 	struct block *l = e->loc;
-	register char **owp = wp;
+	char **owp = wp;
 
 	if (wp[1] == NULL) {
 		static const char *const args [] = { "set", "-", NULL };
@@ -669,7 +669,7 @@ int
 c_unset(wp)
 	char **wp;
 {
-	register char *id;
+	char *id;
 	int optc, unset_var = 1;
 	int ret = 0;
 
@@ -816,8 +816,8 @@ clocktos(t)
 	clock_t t;
 {
 	static char temp[22]; /* enough for 64 bit clock_t */
-	register int i;
-	register char *cp = temp + sizeof(temp);
+	int i;
+	char *cp = temp + sizeof(temp);
 
 	/* note: posix says must use max precision, ie, if clk_tck is
 	 * 1000, must print 3 places after decimal (if non-zero, else 1).
Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.23 src/bin/ksh/misc.c:1.24
--- src/bin/ksh/misc.c:1.23	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/misc.c	Tue May  8 16:37:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.23 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: misc.c,v 1.24 2018/05/08 16:37:59 kamil Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,7 +6,7 @@
 #include 

CVS commit: src/bin/ksh

2018-01-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 24 09:53:21 UTC 2018

Modified Files:
src/bin/ksh: c_ksh.c exec.c lex.c proto.h table.c var.c vi.c

Log Message:
ksh: Rename a local function tsearch to mytsearch

This removes a clash with well-known libc function tsearch(3) from POSIX.

This allows to build ksh against MSan.

The new name might not be perfect, but long term ksh should be switched to
the libc version.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/exec.c
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/lex.c
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/proto.h
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/table.c
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/var.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.26 src/bin/ksh/c_ksh.c:1.27
--- src/bin/ksh/c_ksh.c:1.26	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/c_ksh.c	Wed Jan 24 09:53:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.27 2018/01/24 09:53:20 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.27 2018/01/24 09:53:20 kamil Exp $");
 #endif
 
 #include 
@@ -470,9 +470,9 @@ c_whence(wp)
 	while ((vflag || ret == 0) && (id = *wp++) != NULL) {
 		tp = NULL;
 		if ((iam_whence || vflag) && !pflag)
-			tp = tsearch(, id, hash(id));
+			tp = mytsearch(, id, hash(id));
 		if (!tp && !pflag) {
-			tp = tsearch(, id, hash(id));
+			tp = mytsearch(, id, hash(id));
 			if (tp && !(tp->flag & ISSET))
 tp = NULL;
 		}
@@ -946,7 +946,7 @@ c_alias(wp)
 			alias = str_nsave(alias, val++ - alias, ATEMP);
 		h = hash(alias);
 		if (val == NULL && !tflag && !xflag) {
-			ap = tsearch(t, alias, h);
+			ap = mytsearch(t, alias, h);
 			if (ap != NULL && (ap->flag)) {
 if (pflag)
 	shf_puts("alias ", shl_stdout);
@@ -1017,7 +1017,7 @@ c_unalias(wp)
 	wp += builtin_opt.optind;
 
 	for (; *wp != NULL; wp++) {
-		ap = tsearch(t, *wp, hash(*wp));
+		ap = mytsearch(t, *wp, hash(*wp));
 		if (ap == NULL) {
 			rv = 1;	/* POSIX */
 			continue;

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.25 src/bin/ksh/exec.c:1.26
--- src/bin/ksh/exec.c:1.25	Wed Jan 24 09:21:20 2018
+++ src/bin/ksh/exec.c	Wed Jan 24 09:53:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.25 2018/01/24 09:21:20 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.26 2018/01/24 09:53:21 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.25 2018/01/24 09:21:20 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.26 2018/01/24 09:53:21 kamil Exp $");
 #endif
 
 #include 
@@ -775,7 +775,7 @@ shcomexec(wp)
 {
 	register struct tbl *tp;
 
-	tp = tsearch(, *wp, hash(*wp));
+	tp = mytsearch(, *wp, hash(*wp));
 	if (tp == NULL)
 		internal_errorf(1, "shcomexec: %s", *wp);
 	return call_builtin(tp, wp);
@@ -795,7 +795,7 @@ findfunc(name, h, create)
 	struct tbl *tp = (struct tbl *) 0;
 
 	for (l = e->loc; l; l = l->next) {
-		tp = tsearch(>funs, name, h);
+		tp = mytsearch(>funs, name, h);
 		if (tp)
 			break;
 		if (!l->next && create) {
@@ -906,7 +906,7 @@ findcom(name, flags)
 		flags &= ~FC_FUNC;
 		goto Search;
 	}
-	tbi = (flags & FC_BI) ? tsearch(, name, h) : NULL;
+	tbi = (flags & FC_BI) ? mytsearch(, name, h) : NULL;
 	/* POSIX says special builtins first, then functions, then
 	 * POSIX regular builtins, then search path...
 	 */
@@ -936,7 +936,7 @@ findcom(name, flags)
 	if (!tp && (flags & FC_UNREGBI) && tbi)
 		tp = tbi;
 	if (!tp && (flags & FC_PATH) && !(flags & FC_DEFPATH)) {
-		tp = tsearch(, name, h);
+		tp = mytsearch(, name, h);
 		if (tp && (tp->flag & ISSET) && eaccess(tp->val.s, X_OK) != 0) {
 			if (tp->flag & ALLOC) {
 tp->flag &= ~ALLOC;

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.21 src/bin/ksh/lex.c:1.22
--- src/bin/ksh/lex.c:1.21	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/lex.c	Wed Jan 24 09:53:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.21 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: lex.c,v 1.22 2018/01/24 09:53:21 kamil Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.21 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: lex.c,v 1.22 2018/01/24 09:53:21 kamil Exp $");
 #endif
 
 
@@ -734,13 +734,13 @@ Done:
 		int h = hash(ident);
 
 		/* { */
-		if ((cf & KEYWORD) && (p = tsearch(, ident, h))
+		if ((cf & KEYWORD) && (p = mytsearch(, ident, h))
 		&& (!(cf & ESACONLY) || p->val.i == ESAC || p->val.i == '}'))
 		{
 			afree(yylval.cp, ATEMP);
 			return p->val.i;
 		}
-		if ((cf & ALIAS) && (p = tsearch(, ident, h))
+		if ((cf & ALIAS) && (p 

CVS commit: src/bin/ksh

2018-01-24 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jan 24 09:21:20 UTC 2018

Modified Files:
src/bin/ksh: exec.c proto.h table.c var.c

Log Message:
ksh: Rename a local function tdelete to mytdelete

This removes a clash with well-known libc function tdelete(3) from POSIX.

This allows to build ksh against MSan.

The new name might not be perfect, but long term ksh should be switched to
the libc version.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/exec.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/proto.h
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/table.c
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.24 src/bin/ksh/exec.c:1.25
--- src/bin/ksh/exec.c:1.24	Sat Jul  1 23:12:08 2017
+++ src/bin/ksh/exec.c	Wed Jan 24 09:21:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.24 2017/07/01 23:12:08 joerg Exp $	*/
+/*	$NetBSD: exec.c,v 1.25 2018/01/24 09:21:20 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.24 2017/07/01 23:12:08 joerg Exp $");
+__RCSID("$NetBSD: exec.c,v 1.25 2018/01/24 09:21:20 kamil Exp $");
 #endif
 
 #include 
@@ -843,7 +843,7 @@ define(name, t)
 	}
 
 	if (t == NULL) {		/* undefine */
-		tdelete(tp);
+		mytdelete(tp);
 		return was_set ? 0 : 1;
 	}
 

Index: src/bin/ksh/proto.h
diff -u src/bin/ksh/proto.h:1.10 src/bin/ksh/proto.h:1.11
--- src/bin/ksh/proto.h:1.10	Sat Jul  1 23:12:08 2017
+++ src/bin/ksh/proto.h	Wed Jan 24 09:21:20 2018
@@ -1,9 +1,9 @@
-/*	$NetBSD: proto.h,v 1.10 2017/07/01 23:12:08 joerg Exp $	*/
+/*	$NetBSD: proto.h,v 1.11 2018/01/24 09:21:20 kamil Exp $	*/
 
 /*
  * prototypes for PD-KSH
  * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang "
- * $Id: proto.h,v 1.10 2017/07/01 23:12:08 joerg Exp $
+ * $Id: proto.h,v 1.11 2018/01/24 09:21:20 kamil Exp $
  */
 
 #include 
@@ -218,7 +218,7 @@ unsigned int 	hash	ARGS((const char *));
 void 	tinit		ARGS((struct table *, Area *, int));
 struct tbl *	tsearch	ARGS((struct table *, const char *, unsigned int));
 struct tbl *	tenter	ARGS((struct table *, const char *, unsigned int));
-void 	tdelete		ARGS((struct tbl *));
+void 	mytdelete		ARGS((struct tbl *));
 void 	twalk		ARGS((struct tstate *, struct table *));
 struct tbl *	tnext	ARGS((struct tstate *));
 struct tbl **	tsort	ARGS((struct table *));

Index: src/bin/ksh/table.c
diff -u src/bin/ksh/table.c:1.4 src/bin/ksh/table.c:1.5
--- src/bin/ksh/table.c:1.4	Mon Jun 23 11:39:04 2003
+++ src/bin/ksh/table.c	Wed Jan 24 09:21:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: table.c,v 1.4 2003/06/23 11:39:04 agc Exp $	*/
+/*	$NetBSD: table.c,v 1.5 2018/01/24 09:21:20 kamil Exp $	*/
 
 /*
  * dynamic hashed associative table for commands and variables
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: table.c,v 1.4 2003/06/23 11:39:04 agc Exp $");
+__RCSID("$NetBSD: table.c,v 1.5 2018/01/24 09:21:20 kamil Exp $");
 #endif
 
 
@@ -144,7 +144,7 @@ tenter(tp, n, h)
 }
 
 void
-tdelete(p)
+mytdelete(p)
 	register struct tbl *p;
 {
 	p->flag = 0;

Index: src/bin/ksh/var.c
diff -u src/bin/ksh/var.c:1.21 src/bin/ksh/var.c:1.22
--- src/bin/ksh/var.c:1.21	Sat Jul  1 23:12:08 2017
+++ src/bin/ksh/var.c	Wed Jan 24 09:21:20 2018
@@ -1,9 +1,9 @@
-/*	$NetBSD: var.c,v 1.21 2017/07/01 23:12:08 joerg Exp $	*/
+/*	$NetBSD: var.c,v 1.22 2018/01/24 09:21:20 kamil Exp $	*/
 
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: var.c,v 1.21 2017/07/01 23:12:08 joerg Exp $");
+__RCSID("$NetBSD: var.c,v 1.22 2018/01/24 09:21:20 kamil Exp $");
 #endif
 
 #include 
@@ -939,7 +939,7 @@ unspecial(name)
 
 	tp = tsearch(, name, hash(name));
 	if (tp)
-		tdelete(tp);
+		mytdelete(tp);
 }
 
 #ifdef KSH



CVS commit: src/bin/ksh

2018-01-16 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed Jan 17 00:29:22 UTC 2018

Modified Files:
src/bin/ksh: history.c

Log Message:
Use 0600 as the mode for histfile here too.

pointed out by John D. Baker in PR bin/52480


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/history.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/history.c
diff -u src/bin/ksh/history.c:1.17 src/bin/ksh/history.c:1.18
--- src/bin/ksh/history.c:1.17	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/history.c	Wed Jan 17 00:29:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.17 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: history.c,v 1.18 2018/01/17 00:29:22 maya Exp $	*/
 
 /*
  * command history
@@ -19,7 +19,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: history.c,v 1.17 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: history.c,v 1.18 2018/01/17 00:29:22 maya Exp $");
 #endif
 
 #include 
@@ -753,7 +753,7 @@ hist_finish()
   else
 hp = histlist;
 
-  if ((fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777)) != -1) {
+  if ((fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0600)) != -1) {
 /* Remove anything written before we got the lock */
 ftruncate(fd, 0);
 if ((fh = fdopen(fd, "w")) != NULL) {



CVS commit: src/bin/ksh

2017-07-01 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Jul  1 23:12:09 UTC 2017

Modified Files:
src/bin/ksh: edit.c edit.h exec.c expr.c proto.h var.c

Log Message:
Kill enough K cruft to build with clang again.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/edit.c
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/edit.h
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/exec.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/expr.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/proto.h
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.33 src/bin/ksh/edit.c:1.34
--- src/bin/ksh/edit.c:1.33	Fri Jun 30 05:18:36 2017
+++ src/bin/ksh/edit.c	Sat Jul  1 23:12:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.33 2017/06/30 05:18:36 kamil Exp $	*/
+/*	$NetBSD: edit.c,v 1.34 2017/07/01 23:12:08 joerg Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.33 2017/06/30 05:18:36 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.34 2017/07/01 23:12:08 joerg Exp $");
 #endif
 
 #include 
@@ -194,8 +194,7 @@ x_puts(s)
 }
 
 bool
-x_mode(onoff)
-	bool	onoff;
+x_mode(bool onoff)
 {
 	static bool	x_cur_mode;
 	bool		prev;

Index: src/bin/ksh/edit.h
diff -u src/bin/ksh/edit.h:1.4 src/bin/ksh/edit.h:1.5
--- src/bin/ksh/edit.h:1.4	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/edit.h	Sat Jul  1 23:12:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.h,v 1.4 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: edit.h,v 1.5 2017/07/01 23:12:08 joerg Exp $	*/
 
 /* NAME:
  *  edit.h - globals for edit modes
@@ -10,7 +10,7 @@
  *  
  *
  * RCSid:
- *  $NetBSD: edit.h,v 1.4 2017/06/30 04:41:19 kamil Exp $
+ *  $NetBSD: edit.h,v 1.5 2017/07/01 23:12:08 joerg Exp $
  *
  */
 
@@ -50,7 +50,7 @@ int 	x_getc		ARGS((void));
 void 	x_flush		ARGS((void));
 void 	x_putc		ARGS((int c));
 void 	x_puts		ARGS((const char *s));
-bool 	x_mode		ARGS((bool onoff));
+bool 	x_mode(bool onoff);
 int 	promptlen	ARGS((const char *cp, const char **spp));
 int	x_do_comment	ARGS((char *buf, int bsize, int *lenp));
 void	x_print_expansions ARGS((int nwords, char *const *words, int is_command));

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.23 src/bin/ksh/exec.c:1.24
--- src/bin/ksh/exec.c:1.23	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/exec.c	Sat Jul  1 23:12:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.23 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.24 2017/07/01 23:12:08 joerg Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.23 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.24 2017/07/01 23:12:08 joerg Exp $");
 #endif
 
 #include 
@@ -30,7 +30,7 @@ static int	call_builtin ARGS((struct tbl
 static int	iosetup ARGS((struct ioword *, struct tbl *));
 static int	herein ARGS((const char *, int));
 #ifdef KSH
-static char 	*do_selectargs ARGS((char **, bool));
+static char 	*do_selectargs(char **, bool);
 #endif /* KSH */
 #ifdef KSH
 static int	dbteste_isa ARGS((Test_env *, Test_meta));
@@ -1322,9 +1322,7 @@ herein(content, sub)
  *	print the args in column form - assuming that we can
  */
 static char *
-do_selectargs(ap, print_menu)
-	register char **ap;
-	bool print_menu;
+do_selectargs(char **ap, bool print_menu)
 {
 	static const char *const read_args[] = {
 	"read", "-r", "REPLY", (char *) 0

Index: src/bin/ksh/expr.c
diff -u src/bin/ksh/expr.c:1.10 src/bin/ksh/expr.c:1.11
--- src/bin/ksh/expr.c:1.10	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/expr.c	Sat Jul  1 23:12:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr.c,v 1.10 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: expr.c,v 1.11 2017/07/01 23:12:08 joerg Exp $	*/
 
 /*
  * Korn expression evaluation
@@ -9,7 +9,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: expr.c,v 1.10 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: expr.c,v 1.11 2017/07/01 23:12:08 joerg Exp $");
 #endif
 
 
@@ -138,8 +138,7 @@ static voidevalerr  ARGS((Expr_s
   const char *str)) GCC_FUNC_ATTR(noreturn);
 static struct tbl *evalexpr ARGS((Expr_state *es, enum prec prec));
 static voidtokenARGS((Expr_state *es));
-static struct tbl *do_ppmm  ARGS((Expr_state *es, enum token op,
-  struct tbl *vasn, bool is_prefix));
+static struct tbl *do_ppmm(Expr_state *, enum token, struct tbl *, bool);
 static void	   assign_check ARGS((Expr_state *es, enum token op,
   struct tbl *vasn));
 static struct tbl *tempvar  ARGS((void));
@@ -537,11 +536,7 @@ token(es)
 
 /* Do a ++ or -- operation */
 static struct tbl *
-do_ppmm(es, op, vasn, is_prefix)
-	Expr_state *es;
-	enum token op;
-	struct tbl *vasn;
-	bool is_prefix;
+do_ppmm(Expr_state *es, enum token op, struct tbl *vasn, bool is_prefix)
 {
 	struct tbl *vl;
 	int oval;

Index: src/bin/ksh/proto.h
diff 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 05:18:36 UTC 2017

Modified Files:
src/bin/ksh: edit.c

Log Message:
ksh: Eliminate dead function x_complete_word()


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/edit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.32 src/bin/ksh/edit.c:1.33
--- src/bin/ksh/edit.c:1.32	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/edit.c	Fri Jun 30 05:18:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.32 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: edit.c,v 1.33 2017/06/30 05:18:36 kamil Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.32 2017/06/30 04:41:19 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.33 2017/06/30 05:18:36 kamil Exp $");
 #endif
 
 #include 
@@ -451,35 +451,6 @@ static char	*add_glob ARGS((const char *
 static void	glob_table ARGS((const char *, XPtrV *, struct table *));
 static void	glob_path ARGS((int, const char *, XPtrV *, const char *));
 
-#if 0 /* not used... */
-int	x_complete_word ARGS((const char *, int, int, int *, char **));
-int
-x_complete_word(str, slen, is_command, nwordsp, ret)
-	const char *str;
-	int slen;
-	int is_command;
-	int *nwordsp;
-	char **ret;
-{
-	int nwords;
-	int prefix_len;
-	char **words;
-
-	nwords = (is_command ? x_command_glob : x_file_glob)(XCF_FULLPATH,
-str, slen, );
-	*nwordsp = nwords;
-	if (nwords == 0) {
-		*ret = (char *) 0;
-		return -1;
-	}
-
-	prefix_len = x_longest_prefix(nwords, words);
-	*ret = str_nsave(words[0], prefix_len, ATEMP);
-	x_free_words(nwords, words);
-	return prefix_len;
-}
-#endif /* 0 */
-
 void
 x_print_expansions(nwords, words, is_command)
 	int nwords;



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 05:14:12 UTC 2017

Modified Files:
src/bin/ksh: expand.h

Log Message:
ksh: Eliminate dead code from expand.h


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/expand.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/expand.h
diff -u src/bin/ksh/expand.h:1.5 src/bin/ksh/expand.h:1.6
--- src/bin/ksh/expand.h:1.5	Fri Oct 18 19:53:34 2013
+++ src/bin/ksh/expand.h	Fri Jun 30 05:14:12 2017
@@ -1,30 +1,12 @@
-/*	$NetBSD: expand.h,v 1.5 2013/10/18 19:53:34 christos Exp $	*/
+/*	$NetBSD: expand.h,v 1.6 2017/06/30 05:14:12 kamil Exp $	*/
 
 /*
  * Expanding strings
  */
-/* $Id: expand.h,v 1.5 2013/10/18 19:53:34 christos Exp $ */
+/* $Id: expand.h,v 1.6 2017/06/30 05:14:12 kamil Exp $ */
 
 #define X_EXTRA		8	/* this many extra bytes in X string */
 
-#if 0/* Usage */
-	XString xs;
-	char *xp;
-
-	Xinit(xs, xp, 128, ATEMP); /* allocate initial string */
-	while ((c = generate()) {
-		Xcheck(xs, xp);	/* expand string if necessary */
-		Xput(xs, xp, c); /* add character */
-	}
-	return Xclose(xs, xp);	/* resize string */
-/*
- * NOTE:
- * The Xcheck and Xinit macros have a magic + X_EXTRA in the lengths.
- * This is so that you can put up to X_EXTRA characters in a XString
- * before calling Xcheck. (See yylex in lex.c)
- */
-#endif /* 0 */
-
 typedef struct XString {
 	char   *end, *beg;	/* end, begin of string */
 	size_t	len;		/* length */



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:44:46 UTC 2017

Modified Files:
src/bin/ksh: sh.h

Log Message:
ksh: Drop old hack for FreeBSD 1.1.5 and CLK_TCK


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.34 src/bin/ksh/sh.h:1.35
--- src/bin/ksh/sh.h:1.34	Fri Jun 30 04:41:19 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 04:44:46 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.34 2017/06/30 04:41:19 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.35 2017/06/30 04:44:46 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.34 2017/06/30 04:41:19 kamil Exp $ */
+/* $Id: sh.h,v 1.35 2017/06/30 04:44:46 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -47,9 +47,6 @@
 # endif /* L_SET */
 #endif /* !SEEK_SET */
 
-/* Some machines (eg, FreeBSD 1.1.5) define CLK_TCK in limits.h
- * (ksh_limval.h assumes limits has been included, if available)
- */
 #include 
 
 #include 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:41:19 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c c_test.c edit.c edit.h emacs.c eval.c
exec.c expr.c history.c io.c jobs.c lex.c mail.c main.c misc.c
proto.h sh.h syn.c trap.c tty.c var.c vi.c

Log Message:
ksh: Upgrade to C99 

This shell already used C99 functions.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/c_sh.c src/bin/ksh/exec.c \
src/bin/ksh/misc.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/c_test.c src/bin/ksh/proto.h \
src/bin/ksh/tty.c
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/edit.c
cvs rdiff -u -r1.3 -r1.4 src/bin/ksh/edit.h
cvs rdiff -u -r1.36 -r1.37 src/bin/ksh/emacs.c
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/eval.c src/bin/ksh/main.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/expr.c src/bin/ksh/syn.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/history.c src/bin/ksh/io.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/jobs.c
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/lex.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/mail.c
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/sh.h
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/trap.c
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/var.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.25 src/bin/ksh/c_ksh.c:1.26
--- src/bin/ksh/c_ksh.c:1.25	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_ksh.c	Fri Jun 30 04:41:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.26 2017/06/30 04:41:19 kamil Exp $");
 #endif
 
 #include 
@@ -717,7 +717,7 @@ c_typeset(wp)
 		for (i = builtin_opt.optind; wp[i]; i++) {
 			if (func) {
 f = findfunc(wp[i], hash(wp[i]),
-	 (fset_AL) ? TRUE : FALSE);
+	 (fset_AL) ? true : false);
 if (!f) {
 	/* at ksh does ++rval: bogus */
 	rval = 1;
@@ -1173,7 +1173,7 @@ c_kill(wp)
 	/* assume old style options if -digits or -UPPERCASE */
 	if ((p = wp[1]) && *p == '-'
 	&& (digit(p[1]) || isupper((unsigned char)p[1]))) {
-		if (!(t = gettrap(p + 1, TRUE))) {
+		if (!(t = gettrap(p + 1, true))) {
 			bi_errorf("bad signal `%s'", p + 1);
 			return 1;
 		}
@@ -1187,7 +1187,7 @@ c_kill(wp)
 lflag = 1;
 break;
 			  case 's':
-if (!(t = gettrap(builtin_opt.optarg, TRUE))) {
+if (!(t = gettrap(builtin_opt.optarg, true))) {
 	bi_errorf("bad signal `%s'",
 		builtin_opt.optarg);
 	return 1;
@@ -1311,7 +1311,7 @@ c_getopts(wp)
 		bi_errorf("missing name argument");
 		return 1;
 	}
-	if (!*var || *skip_varname(var, TRUE)) {
+	if (!*var || *skip_varname(var, true)) {
 		bi_errorf("%s: is not an identifier", var);
 		return 1;
 	}

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.22 src/bin/ksh/c_sh.c:1.23
--- src/bin/ksh/c_sh.c:1.22	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 04:41:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.23 2017/06/30 04:41:19 kamil Exp $");
 #endif
 
 #include 
@@ -464,7 +464,7 @@ c_eval(wp)
 		exstat = subst_exstat;
 	}
 
-	rv = shell(s, FALSE);
+	rv = shell(s, false);
 	afree(s, ATEMP);
 	return rv;
 }
@@ -515,13 +515,13 @@ c_trap(wp)
 	 * command 'exit' isn't confused with the pseudo-signal
 	 * 'EXIT'.
 	 */
-	s = (gettrap(*wp, FALSE) == NULL) ? *wp++ : NULL; /* get command */
+	s = (gettrap(*wp, false) == NULL) ? *wp++ : NULL; /* get command */
 	if (s != NULL && s[0] == '-' && s[1] == '\0')
 		s = NULL;
 
 	/* set/clear traps */
 	while (*wp != NULL) {
-		p = gettrap(*wp++, TRUE);
+		p = gettrap(*wp++, true);
 		if (p == NULL) {
 			bi_errorf("bad signal %s", wp[-1]);
 			return 1;
@@ -546,7 +546,7 @@ c_exitreturn(wp)
 	if (arg) {
 	if (!getn(arg, )) {
 		exstat = 1;
-		warningf(TRUE, "%s: bad number", arg);
+		warningf(true, "%s: bad number", arg);
 	} else
 		exstat = n;
 	}
@@ -612,7 +612,7 @@ c_brkcont(wp)
 		 * scripts, but don't generate an error (ie, keep going).
 		 */
 		if (n == quit) {
-			warningf(TRUE, "%s: cannot %s", wp[0], wp[0]);
+			warningf(true, "%s: cannot %s", wp[0], wp[0]);
 			return 0;
 		}
 		/* POSIX says if n is too big, the last enclosing loop
@@ -621,7 +621,7 @@ c_brkcont(wp)
 		 */
 		if (last_ep)
 			last_ep->flags &= ~EF_BRKCONT_PASS;
-		warningf(TRUE, "%s: can only %s %d level(s)",
+		warningf(true, "%s: can only %s %d 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:30:26 UTC 2017

Modified Files:
src/bin/ksh: main.c sh.h

Log Message:
ksh: Eliminate dead MEM_DEBUG sections, there is missing code for it

MEM_DEBUG used to contain malloc(3) debugging facilities.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/main.c
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/main.c
diff -u src/bin/ksh/main.c:1.20 src/bin/ksh/main.c:1.21
--- src/bin/ksh/main.c:1.20	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/main.c	Fri Jun 30 04:30:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.20 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: main.c,v 1.21 2017/06/30 04:30:26 kamil Exp $	*/
 
 /*
  * startup, main loop, environments and error handling
@@ -10,7 +10,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.20 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2017/06/30 04:30:26 kamil Exp $");
 #endif
 
 
@@ -102,11 +102,6 @@ main(int argc, char *argv[])
 	struct env env;
 	pid_t ppid;
 
-#ifdef MEM_DEBUG
-	chmem_set_defaults("ct", 1);
-	/* chmem_push("+c", 1); */
-#endif /* MEM_DEBUG */
-
 	/* make sure argv[] is sane */
 	if (!*argv) {
 		static const char	*empty_argv[] = {
@@ -711,9 +706,6 @@ quitenv()
 	kill(0, sig);
 }
 			}
-#ifdef MEM_DEBUG
-			chmem_allfree();
-#endif /* MEM_DEBUG */
 		}
 		exit(exstat);
 	}

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.32 src/bin/ksh/sh.h:1.33
--- src/bin/ksh/sh.h:1.32	Fri Jun 30 04:22:22 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 04:30:26 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.33 2017/06/30 04:30:26 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $ */
+/* $Id: sh.h,v 1.33 2017/06/30 04:30:26 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -205,10 +205,6 @@ EXTERN	Area	aperm;		/* permanent object 
 #define	APERM	
 #define	ATEMP	>area
 
-#ifdef MEM_DEBUG
-# include "chmem.h" /* a debugging front end for malloc et. al. */
-#endif /* MEM_DEBUG */
-
 #ifdef KSH_DEBUG
 # define kshdebug_init()	kshdebug_init_()
 # define kshdebug_printf(a)	kshdebug_printf_ a



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:22:22 UTC 2017

Modified Files:
src/bin/ksh: Makefile config.h sh.h
Removed Files:
src/bin/ksh: sigact.c sigact.h

Log Message:
ksh: Drop support for OSes without POSIX sigaction(2)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/Makefile
cvs rdiff -u -r1.52 -r1.53 src/bin/ksh/config.h
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/sh.h
cvs rdiff -u -r1.7 -r0 src/bin/ksh/sigact.c
cvs rdiff -u -r1.3 -r0 src/bin/ksh/sigact.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.33 src/bin/ksh/Makefile:1.34
--- src/bin/ksh/Makefile:1.33	Wed Mar 16 23:02:23 2016
+++ src/bin/ksh/Makefile	Fri Jun 30 04:22:22 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2016/03/16 23:02:23 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2017/06/30 04:22:22 kamil Exp $
 
 WARNS=3
 CWARNFLAGS.clang+=	-Wno-error=cast-qual
@@ -10,8 +10,8 @@ CPPFLAGS+=	-I.
 PROG=	ksh
 SRCS=	alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \
 	eval.c exec.c expr.c history.c io.c jobs.c lex.c mail.c \
-	main.c misc.c path.c shf.c sigact.c syn.c table.c trap.c \
-	tree.c tty.c var.c version.c vi.c
+	main.c misc.c path.c shf.c syn.c table.c trap.c tree.c tty.c \
+	var.c version.c vi.c
 DPSRCS=	emacs.out siglist.out
 .if (${MKMAN} != "no")
 DPSRCS+=ksh.1

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.52 src/bin/ksh/config.h:1.53
--- src/bin/ksh/config.h:1.52	Fri Jun 30 04:11:57 2017
+++ src/bin/ksh/config.h	Fri Jun 30 04:22:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.52 2017/06/30 04:11:57 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.53 2017/06/30 04:22:22 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -30,9 +30,6 @@
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 
-/* Define to use the fake posix signal routines (sigact.[ch]) */
-/* #undef USE_FAKE_SIGACT */
-
 /* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
 /* #undef BSD_PGRP */
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.31 src/bin/ksh/sh.h:1.32
--- src/bin/ksh/sh.h:1.31	Fri Jun 30 02:51:14 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 04:22:22 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $ */
+/* $Id: sh.h,v 1.32 2017/06/30 04:22:22 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -80,10 +80,6 @@
 
 typedef	RETSIGTYPE (*handler_t) ARGS((int));	/* signal handler */
 
-#ifdef USE_FAKE_SIGACT
-# include "sigact.h"			/* use sjg's fake sigaction() */
-#endif
-
 #ifdef HAVE_PATHS_H
 # include 
 #endif /* HAVE_PATHS_H */



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:11:57 UTC 2017

Modified Files:
src/bin/ksh: c_test.c config.h

Log Message:
ksh: Drop support for OSes that don't map /dev/fd


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/c_test.c
cvs rdiff -u -r1.51 -r1.52 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_test.c
diff -u src/bin/ksh/c_test.c:1.7 src/bin/ksh/c_test.c:1.8
--- src/bin/ksh/c_test.c:1.7	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/c_test.c	Fri Jun 30 04:11:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $	*/
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -11,7 +11,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
+__RCSID("$NetBSD: c_test.c,v 1.8 2017/06/30 04:11:57 kamil Exp $");
 #endif
 
 #include 
@@ -422,19 +422,11 @@ test_eval(te, op, opnd1, opnd2, do_eval)
 	return 1;
 }
 
-/* Nasty kludge to handle Korn's bizarre /dev/fd hack */
 static int
 test_stat(pathx, statb)
 	const char *pathx;
 	struct stat *statb;
 {
-#if !defined(HAVE_DEV_FD)
-	int fd;
-
-	if (strncmp(pathx, "/dev/fd/", 8) == 0 && getn(pathx + 8, ))
-		return fstat(fd, statb);
-#endif /* !HAVE_DEV_FD */
-
 	return stat(pathx, statb);
 }
 
@@ -448,22 +440,6 @@ test_eaccess(pathx, mode)
 {
 	int res;
 
-#if !defined(HAVE_DEV_FD)
-	int fd;
-
-	/* Note: doesn't handle //dev/fd, etc.. (this is ok) */
-	if (strncmp(pathx, "/dev/fd/", 8) == 0 && getn(pathx + 8, )) {
-		int flags;
-
-		if ((flags = fcntl(fd, F_GETFL, 0)) < 0
-		|| (mode & X_OK)
-		|| ((mode & W_OK) && (flags & O_ACCMODE) == O_RDONLY)
-		|| ((mode & R_OK) && (flags & O_ACCMODE) == O_WRONLY))
-			return -1;
-		return 0;
-	}
-#endif /* !HAVE_DEV_FD */
-
 	res = eaccess(pathx, mode);
 	/*
 	 * On most (all?) unixes, access() says everything is executable for

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.51 src/bin/ksh/config.h:1.52
--- src/bin/ksh/config.h:1.51	Fri Jun 30 03:56:12 2017
+++ src/bin/ksh/config.h	Fri Jun 30 04:11:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.51 2017/06/30 03:56:12 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.52 2017/06/30 04:11:57 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -69,9 +69,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if your OS maps references to /dev/fd/n to file descriptor n */
-#define HAVE_DEV_FD 1
-
 /* Default PATH */
 #ifdef RESCUEDIR
 #define DEFAULT_PATH RESCUEDIR ":/bin:/usr/bin:/sbin:/usr/sbin"



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 04:01:48 UTC 2017

Modified Files:
src/bin/ksh: proto.h

Log Message:
ksh: Drop old hack fo SunOS 4.1.x (1990-1994)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/proto.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/proto.h
diff -u src/bin/ksh/proto.h:1.7 src/bin/ksh/proto.h:1.8
--- src/bin/ksh/proto.h:1.7	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/proto.h	Fri Jun 30 04:01:48 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: proto.h,v 1.7 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: proto.h,v 1.8 2017/06/30 04:01:48 kamil Exp $	*/
 
 /*
  * prototypes for PD-KSH
  * originally generated using "cproto.c 3.5 92/04/11 19:28:01 cthuang "
- * $Id: proto.h,v 1.7 2005/06/26 19:09:00 christos Exp $
+ * $Id: proto.h,v 1.8 2017/06/30 04:01:48 kamil Exp $
  */
 
 /* alloc.c */
@@ -273,26 +273,3 @@ char *	arrayname	ARGS((const char *));
 voidset_array	ARGS((const char *, int, char **));
 /* version.c */
 /* vi.c: see edit.h */
-
-
-/* Hack to avoid billions of compile warnings on SunOS 4.1.x */
-#if defined(MUN) && defined(sun) && !defined(__svr4__)
-extern void bcopy ARGS((const void *, void *, size_t));
-extern intclose ARGS((FILE *));
-extern intprintf ARGS((FILE *, const char *, ...));
-extern intread ARGS((void *, int, int, FILE *));
-extern int ioctl ARGS((int, int, void *));
-extern int killpg ARGS((int, int));
-extern int nice ARGS((int));
-extern int readlink ARGS((const char *, char *, int));
-extern int setpgrp ARGS((int, int));
-extern int strcasecmp ARGS((const char *, const char *));
-extern int tolower ARGS((int));
-extern int toupper ARGS((int));
-/*  Include files aren't included yet */
-extern int getrlimit ARGS(( /* int, struct rlimit * */ ));
-extern int getrusage ARGS(( /* int, struct rusage * */ ));
-extern int gettimeofday ARGS(( /* struct timeval *, struct timezone * */ ));
-extern int setrlimit ARGS(( /* int, struct rlimit * */ ));
-extern int lstat ARGS(( /* const char *, struct stat * */ ));
-#endif



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:56:12 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c c_test.c config.h edit.c emacs.c eval.c
exec.c history.c io.c jobs.c mail.c main.c path.c shf.c tty.c var.c
vi.c
Removed Files:
src/bin/ksh: ksh_stat.h

Log Message:
ksh: Drop support for systems without 

In future the order of includes will be normalized with KNF.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/c_sh.c src/bin/ksh/exec.c
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/c_test.c src/bin/ksh/mail.c
cvs rdiff -u -r1.50 -r1.51 src/bin/ksh/config.h
cvs rdiff -u -r1.30 -r1.31 src/bin/ksh/edit.c
cvs rdiff -u -r1.35 -r1.36 src/bin/ksh/emacs.c
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/eval.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/history.c src/bin/ksh/io.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/jobs.c
cvs rdiff -u -r1.3 -r0 src/bin/ksh/ksh_stat.h
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/main.c
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/path.c src/bin/ksh/shf.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/tty.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/var.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.24 src/bin/ksh/c_ksh.c:1.25
--- src/bin/ksh/c_ksh.c:1.24	Thu Jun 22 19:41:07 2017
+++ src/bin/ksh/c_ksh.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,13 +6,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
-#include "sh.h"
-#include "ksh_stat.h"
+#include 
 #include 
 
+#include "sh.h"
+
 int
 c_cd(wp)
 	char	**wp;

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.21 src/bin/ksh/c_sh.c:1.22
--- src/bin/ksh/c_sh.c:1.21	Fri Jun 30 03:43:57 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,16 +6,15 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
+#include 
 #include 
 #include 
 #include 
 
 #include "sh.h"
-#include "ksh_stat.h" 	/* umask() */
-
 
 static	char *clocktos ARGS((clock_t t));
 
Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.21 src/bin/ksh/exec.c:1.22
--- src/bin/ksh/exec.c:1.21	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/exec.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.22 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,14 +6,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
+#include 
+#include 
 
 #include "sh.h"
 #include "c_test.h"
-#include 
-#include "ksh_stat.h"
 
 /* Does ps4 get parameter substitutions done? */
 #ifdef KSH

Index: src/bin/ksh/c_test.c
diff -u src/bin/ksh/c_test.c:1.6 src/bin/ksh/c_test.c:1.7
--- src/bin/ksh/c_test.c:1.6	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/c_test.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_test.c,v 1.6 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * test(1); version 7-like  --  author Erik Baalbergen
@@ -11,12 +11,12 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_test.c,v 1.6 2005/06/26 19:09:00 christos Exp $");
+__RCSID("$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
+#include 
 
 #include "sh.h"
-#include "ksh_stat.h"
 #include "c_test.h"
 
 /* test(1) accepts the following grammar:
Index: src/bin/ksh/mail.c
diff -u src/bin/ksh/mail.c:1.6 src/bin/ksh/mail.c:1.7
--- src/bin/ksh/mail.c:1.6	Fri Jun 30 03:43:57 2017
+++ src/bin/ksh/mail.c	Fri Jun 30 03:56:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $	*/
+/*	$NetBSD: mail.c,v 1.7 2017/06/30 03:56:12 kamil Exp $	*/
 
 /*
  * Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -7,17 +7,17 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $");
+__RCSID("$NetBSD: mail.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
 #endif
 
 #include "config.h"
 
 #ifdef KSH
+#include 
 #include 
 #include 
 
 #include "sh.h"
-#include "ksh_stat.h"
 
 #define MBMESSAGE	"You have mail in $_"
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.50 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:43:57 UTC 2017

Modified Files:
src/bin/ksh: c_sh.c c_ulimit.c config.h mail.c main.c var.c
Removed Files:
src/bin/ksh: ksh_time.h

Log Message:
ksh: Drop support for systems with broken  / 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/c_sh.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/c_ulimit.c
cvs rdiff -u -r1.49 -r1.50 src/bin/ksh/config.h
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_time.h
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/mail.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/main.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.20 src/bin/ksh/c_sh.c:1.21
--- src/bin/ksh/c_sh.c:1.20	Fri Jun 30 03:23:18 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,14 +6,15 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
+#include 
 #include 
+#include 
 
 #include "sh.h"
 #include "ksh_stat.h" 	/* umask() */
-#include "ksh_time.h"
 
 
 static	char *clocktos ARGS((clock_t t));

Index: src/bin/ksh/c_ulimit.c
diff -u src/bin/ksh/c_ulimit.c:1.15 src/bin/ksh/c_ulimit.c:1.16
--- src/bin/ksh/c_ulimit.c:1.15	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/c_ulimit.c	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ulimit.c,v 1.15 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: c_ulimit.c,v 1.16 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
 	ulimit -- handle "ulimit" builtin
@@ -20,12 +20,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ulimit.c,v 1.15 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: c_ulimit.c,v 1.16 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
+#include 
+#include 
 
 #include "sh.h"
-#include "ksh_time.h"
 #ifdef HAVE_SYS_RESOURCE_H
 # include 
 #endif /* HAVE_SYS_RESOURCE_H */

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.49 src/bin/ksh/config.h:1.50
--- src/bin/ksh/config.h:1.49	Fri Jun 30 03:35:16 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.49 2017/06/30 03:35:16 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.50 2017/06/30 03:43:57 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -33,9 +33,6 @@
 /* Define if `sys_siglist' is declared by .  */
 #define SYS_SIGLIST_DECLARED 1
 
-/* Define if you can safely include both  and .  */
-#define TIME_WITH_SYS_TIME 1
-
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 
@@ -57,9 +54,6 @@
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 
-/* Define if time() is declared in  */
-#define TIME_DECLARED 1
-
 /* Define if sys_errlist[] and sys_nerr are in the C library */
 #define HAVE_SYS_ERRLIST 1
 
@@ -196,9 +190,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_SYS_RESOURCE_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_SYS_TIME_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_ULIMIT_H
 

Index: src/bin/ksh/mail.c
diff -u src/bin/ksh/mail.c:1.5 src/bin/ksh/mail.c:1.6
--- src/bin/ksh/mail.c:1.5	Sun Jan 15 18:16:30 2006
+++ src/bin/ksh/mail.c	Fri Jun 30 03:43:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mail.c,v 1.5 2006/01/15 18:16:30 jschauma Exp $	*/
+/*	$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
  * Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -7,16 +7,17 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: mail.c,v 1.5 2006/01/15 18:16:30 jschauma Exp $");
+__RCSID("$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
-
 #include "config.h"
 
 #ifdef KSH
+#include 
+#include 
+
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_time.h"
 
 #define MBMESSAGE	"You have mail in $_"
 

Index: src/bin/ksh/main.c
diff -u src/bin/ksh/main.c:1.18 src/bin/ksh/main.c:1.19
--- src/bin/ksh/main.c:1.18	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/main.c	Fri Jun 30 03:43:57 2017
@@ -1,13 +1,15 @@
-/*	$NetBSD: main.c,v 1.18 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: main.c,v 1.19 2017/06/30 03:43:57 kamil Exp $	*/
 
 /*
  * startup, main loop, environments and error handling
  */
 #include 
+#include 
 #include 
+#include 
 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.18 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: main.c,v 1.19 2017/06/30 03:43:57 kamil Exp $");
 #endif
 
 
@@ -15,7 +17,6 @@ __RCSID("$NetBSD: main.c,v 1.18 2017/06/
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_time.h"
 
 extern char 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:35:16 UTC 2017

Modified Files:
src/bin/ksh: config.h ksh_stat.h

Log Message:
ksh: Drop support for systems without POSIX lstat(2)


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/ksh/config.h
cvs rdiff -u -r1.2 -r1.3 src/bin/ksh/ksh_stat.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.48 src/bin/ksh/config.h:1.49
--- src/bin/ksh/config.h:1.48	Fri Jun 30 03:32:28 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:35:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.48 2017/06/30 03:32:28 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.49 2017/06/30 03:35:16 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -72,9 +72,6 @@
 /* Define if you have a sane  header file */
 #define HAVE_TERMIOS_H 1
 
-/* Define if you have a lstat() function in your C library */
-#define HAVE_LSTAT 1
-
 /* Define if you have a sane  header file */
 /* #undef HAVE_TERMIO_H */
 

Index: src/bin/ksh/ksh_stat.h
diff -u src/bin/ksh/ksh_stat.h:1.2 src/bin/ksh/ksh_stat.h:1.3
--- src/bin/ksh/ksh_stat.h:1.2	Sun Jan 12 19:12:00 1997
+++ src/bin/ksh/ksh_stat.h	Fri Jun 30 03:35:16 2017
@@ -1,15 +1,11 @@
-/*	$NetBSD: ksh_stat.h,v 1.2 1997/01/12 19:12:00 tls Exp $	*/
+/*	$NetBSD: ksh_stat.h,v 1.3 2017/06/30 03:35:16 kamil Exp $	*/
 
 /* Wrapper around the ugly sys/stat includes/ifdefs */
-/* $NetBSD: ksh_stat.h,v 1.2 1997/01/12 19:12:00 tls Exp $ */
+/* $NetBSD: ksh_stat.h,v 1.3 2017/06/30 03:35:16 kamil Exp $ */
 
 /* assumes  already included */
 #include 
 
-#ifndef HAVE_LSTAT
-# define lstat(path, buf)	stat(path, buf)
-#endif /* HAVE_LSTAT */
-
 #ifdef STAT_MACROS_BROKEN
 # undef S_ISREG
 # undef S_ISDIR



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:32:28 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without POSIX 


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.47 src/bin/ksh/config.h:1.48
--- src/bin/ksh/config.h:1.47	Fri Jun 30 03:23:18 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:32:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.47 2017/06/30 03:23:18 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.48 2017/06/30 03:32:28 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -84,9 +84,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if you have a POSIX.1 compatible  */
-#define POSIX_SYS_WAIT 1
-
 /* Define if your OS maps references to /dev/fd/n to file descriptor n */
 #define HAVE_DEV_FD 1
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 03:23:18 UTC 2017

Modified Files:
src/bin/ksh: c_sh.c config.h jobs.c
Removed Files:
src/bin/ksh: ksh_times.h

Log Message:
ksh: Drop support for systems with broken times(3)

This fallback code wouldn't work anyway.

times(3) is an obsolete interface by getrusage(2) and gettimeofday(2).
In future it will be swiched to more modern interfaces.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/c_sh.c
cvs rdiff -u -r1.46 -r1.47 src/bin/ksh/config.h
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/jobs.c
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_times.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.19 src/bin/ksh/c_sh.c:1.20
--- src/bin/ksh/c_sh.c:1.19	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/c_sh.c	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,14 +6,15 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.20 2017/06/30 03:23:18 kamil Exp $");
 #endif
 
+#include 
 
 #include "sh.h"
 #include "ksh_stat.h" 	/* umask() */
 #include "ksh_time.h"
-#include "ksh_times.h"
+
 
 static	char *clocktos ARGS((clock_t t));
 
@@ -706,7 +707,7 @@ c_times(wp)
 {
 	struct tms all;
 
-	(void) ksh_times();
+	times();
 	shprintf("Shell: %8ss user ", clocktos(all.tms_utime));
 	shprintf("%8ss system\n", clocktos(all.tms_stime));
 	shprintf("Kids:  %8ss user ", clocktos(all.tms_cutime));
@@ -733,7 +734,7 @@ timex(t, f)
 	extern clock_t j_usrtime, j_systime; /* computed by j_wait */
 	char opts[1];
 
-	t0t = ksh_times();
+	t0t = times();
 	if (t->left) {
 		/*
 		 * Two ways of getting cpu usage of a command: just use t0
@@ -749,7 +750,7 @@ timex(t, f)
 		opts[0] = 0;
 		rv = execute(t->left, f | XTIME);
 		tf |= opts[0];
-		t1t = ksh_times();
+		t1t = times();
 	} else
 		tf = TF_NOARGS;
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.46 src/bin/ksh/config.h:1.47
--- src/bin/ksh/config.h:1.46	Fri Jun 30 02:51:14 2017
+++ src/bin/ksh/config.h	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.46 2017/06/30 02:51:14 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.47 2017/06/30 03:23:18 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -78,9 +78,6 @@
 /* Define if you have a sane  header file */
 /* #undef HAVE_TERMIO_H */
 
-/* Define if you don't have times() or if it always returns 0 */
-/* #undef TIMES_BROKEN */
-
 /* Define if opendir() will open non-directory files */
 /* #undef OPENDIR_DOES_NONDIR */
 

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.16 src/bin/ksh/jobs.c:1.17
--- src/bin/ksh/jobs.c:1.16	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 03:23:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -21,14 +21,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $");
 #endif
 
+#include 
 #include 
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_times.h"
 #include "tty.h"
 
 /* Start of system configuration stuff */
@@ -1263,14 +1263,14 @@ j_sigchld(sig)
 			return RETSIGVAL;
 		}
 
-	ksh_times();
+	times();
 	do {
 		pid = waitpid(-1, , (WNOHANG|WUNTRACED));
 
 		if (pid <= 0)	/* return if would block (0) ... */
 			break;	/* ... or no children or interrupted (-1) */
 
-		ksh_times();
+		times();
 
 		/* find job and process structures for this pid */
 		for (j = job_list; j != (Job *) 0; j = j->next)



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:51:14 UTC 2017

Modified Files:
src/bin/ksh: config.h io.c lex.c sh.h shf.c tree.c

Log Message:
ksh: Assume ANSI C prototypes


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/bin/ksh/config.h
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/io.c
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/lex.c
cvs rdiff -u -r1.30 -r1.31 src/bin/ksh/sh.h
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/shf.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.45 src/bin/ksh/config.h:1.46
--- src/bin/ksh/config.h:1.45	Fri Jun 30 02:38:09 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:51:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.45 2017/06/30 02:38:09 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.46 2017/06/30 02:51:14 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -54,9 +54,6 @@
 /* Define if you don't have setpgrp(), setpgid() or getpgrp() routines */
 /* #undef NO_PGRP */
 
-/* Define if C compiler groks function prototypes */
-#define HAVE_PROTOTYPES 1
-
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 

Index: src/bin/ksh/io.c
diff -u src/bin/ksh/io.c:1.14 src/bin/ksh/io.c:1.15
--- src/bin/ksh/io.c:1.14	Fri Jun 23 00:18:01 2017
+++ src/bin/ksh/io.c	Fri Jun 30 02:51:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $	*/
+/*	$NetBSD: io.c,v 1.15 2017/06/30 02:51:14 kamil Exp $	*/
 
 /*
  * shell buffered IO and formatted output
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $");
+__RCSID("$NetBSD: io.c,v 1.15 2017/06/30 02:51:14 kamil Exp $");
 #endif
 
 
@@ -23,13 +23,7 @@ static int initio_done;
 
 /* A shell error occurred (eg, syntax error, etc.) */
 void
-#ifdef HAVE_PROTOTYPES
 errorf(const char *fmt, ...)
-#else
-errorf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -48,14 +42,7 @@ errorf(fmt, va_alist)
 
 /* like errorf(), but no unwind is done */
 void
-#ifdef HAVE_PROTOTYPES
 warningf(int fileline, const char *fmt, ...)
-#else
-warningf(fileline, fmt, va_alist)
-	int fileline;
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -71,13 +58,7 @@ warningf(fileline, fmt, va_alist)
  * (also unwinds environments for special builtins).
  */
 void
-#ifdef HAVE_PROTOTYPES
 bi_errorf(const char *fmt, ...)
-#else
-bi_errorf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -108,14 +89,7 @@ bi_errorf(fmt, va_alist)
 
 /* Called when something that shouldn't happen does */
 void
-#ifdef HAVE_PROTOTYPES
 internal_errorf(int jump, const char *fmt, ...)
-#else
-internal_errorf(jump, fmt, va_alist)
-	int jump;
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -148,13 +122,7 @@ error_prefix(fileline)
 
 /* printf to shl_out (stderr) with flush */
 void
-#ifdef HAVE_PROTOTYPES
 shellf(const char *fmt, ...)
-#else
-shellf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -168,13 +136,7 @@ shellf(fmt, va_alist)
 
 /* printf to shl_stdout (stdout) */
 void
-#ifdef HAVE_PROTOTYPES
 shprintf(const char *fmt, ...)
-#else
-shprintf(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 
@@ -204,13 +166,7 @@ kshdebug_init_()
 
 /* print to debugging log */
 void
-# ifdef HAVE_PROTOTYPES
 kshdebug_printf_(const char *fmt, ...)
-# else
-kshdebug_printf_(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-# endif
 {
 	va_list va;
 

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.19 src/bin/ksh/lex.c:1.20
--- src/bin/ksh/lex.c:1.19	Fri Jun 23 00:18:01 2017
+++ src/bin/ksh/lex.c	Fri Jun 30 02:51:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $	*/
+/*	$NetBSD: lex.c,v 1.20 2017/06/30 02:51:14 kamil Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $");
+__RCSID("$NetBSD: lex.c,v 1.20 2017/06/30 02:51:14 kamil Exp $");
 #endif
 
 
@@ -836,13 +836,7 @@ readhere(iop)
 }
 
 void
-#ifdef HAVE_PROTOTYPES
 yyerror(const char *fmt, ...)
-#else
-yyerror(fmt, va_alist)
-	const char *fmt;
-	va_dcl
-#endif
 {
 	va_list va;
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.30 src/bin/ksh/sh.h:1.31
--- src/bin/ksh/sh.h:1.30	Fri Jun 30 02:38:10 2017
+++ src/bin/ksh/sh.h	Fri Jun 30 02:51:14 2017
@@ -1,18 +1,14 @@
-/*	$NetBSD: sh.h,v 1.30 2017/06/30 02:38:10 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.30 2017/06/30 02:38:10 kamil Exp $ */
+/* $Id: sh.h,v 1.31 2017/06/30 02:51:14 kamil Exp $ */
 
 #include "config.h"	/* 

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:38:10 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h exec.c jobs.c sh.h

Log Message:
ksh: Drop support for systems without functional waitpid(2)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.44 -r1.45 src/bin/ksh/config.h
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/exec.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/jobs.c
cvs rdiff -u -r1.29 -r1.30 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.6 src/bin/ksh/conf-end.h:1.7
--- src/bin/ksh/conf-end.h:1.6	Fri Jun 30 02:20:47 2017
+++ src/bin/ksh/conf-end.h	Fri Jun 30 02:38:09 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.7 2017/06/30 02:38:09 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.7 2017/06/30 02:38:09 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -22,15 +22,6 @@
 # define EASY_HISTORY			/* sjg's trivial history file */
 #endif
 
-/* Can we safely catch sigchld and wait for processes? */
-#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
-# define JOB_SIGS
-#endif
-
-#if !defined(JOB_SIGS) || !(defined(POSIX_PGRP) || defined(BSD_PGRP))
-# undef JOBS /* if no JOB_SIGS, no job control support */
-#endif
-
 #ifdef HAVE_GCC_FUNC_ATTR
 # define GCC_FUNC_ATTR(x)	__attribute__((x))
 # define GCC_FUNC_ATTR2(x,y)	__attribute__((x,y))

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.44 src/bin/ksh/config.h:1.45
--- src/bin/ksh/config.h:1.44	Fri Jun 30 02:20:47 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:38:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.44 2017/06/30 02:20:47 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.45 2017/06/30 02:38:09 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -187,12 +187,6 @@
 /* Define if you have the valloc function.  */
 #define HAVE_VALLOC 1
 
-/* Define if you have the wait3 function.  */
-#define HAVE_WAIT3 1
-
-/* Define if you have the waitpid function.  */
-#define HAVE_WAITPID 1
-
 /* Define if you have the  header file.  */
 #define HAVE_DIRENT_H 1
 

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.20 src/bin/ksh/exec.c:1.21
--- src/bin/ksh/exec.c:1.20	Fri Jun 30 02:06:59 2017
+++ src/bin/ksh/exec.c	Fri Jun 30 02:38:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $");
 #endif
 
 
@@ -201,11 +201,8 @@ execute(t, flags)
 #ifdef KSH
 	  case TCOPROC:
 	  {
-# ifdef JOB_SIGS
 		sigset_t	omask;
-# endif /* JOB_SIGS */
 
-# ifdef JOB_SIGS
 		/* Block sigchild as we are using things changed in the
 		 * signal handler
 		 */
@@ -218,7 +215,7 @@ execute(t, flags)
 			unwind(i);
 			/*NOTREACHED*/
 		}
-# endif /* JOB_SIGS */
+
 		/* Already have a (live) co-process? */
 		if (coproc.job && coproc.write >= 0)
 			errorf("coprocess already exists");
@@ -249,10 +246,9 @@ execute(t, flags)
 			/* create new coprocess id */
 			++coproc.id;
 		}
-# ifdef JOB_SIGS
+
 		sigprocmask(SIG_SETMASK, , (sigset_t *) 0);
 		e->type = E_EXEC; /* no more need for error handler */
-# endif /* JOB_SIGS */
 
 		/* exchild() closes coproc.* in child after fork,
 		 * will also increment coproc.njobs when the

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.15 src/bin/ksh/jobs.c:1.16
--- src/bin/ksh/jobs.c:1.15	Fri Jun 30 01:52:34 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 02:38:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -14,11 +14,6 @@
  * work :)
  *
  * Notes regarding the copious ifdefs:
- *	- JOB_SIGS is independent of JOBS - it is defined if there are modern
- *	  signal and wait routines available.  This is preferred, even when
- *	  JOBS is not defined, since the shell will not otherwise notice when
- *	  background jobs die until the shell waits for a foreground process
- *	  to die.
  *	- TTY_PGRP defined iff JOBS is defined - defined if there are tty
  *	  process groups
  *	- NEED_PGRP_SYNC defined iff JOBS is defined - see comment below
@@ -26,7 +21,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.16 2017/06/30 02:38:10 kamil Exp $");
 #endif
 
 #include 
@@ -187,10 +182,8 @@ static int_least32_t	

CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:20:47 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h

Log Message:
ksh: Drop support for systems without POSIX signal routines


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.43 -r1.44 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.5 src/bin/ksh/conf-end.h:1.6
--- src/bin/ksh/conf-end.h:1.5	Fri Jun 30 02:13:29 2017
+++ src/bin/ksh/conf-end.h	Fri Jun 30 02:20:47 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.6 2017/06/30 02:20:47 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -23,8 +23,7 @@
 #endif
 
 /* Can we safely catch sigchld and wait for processes? */
-#if (defined(HAVE_WAITPID) || defined(HAVE_WAIT3)) \
-&& (defined(POSIX_SIGNALS))
+#if defined(HAVE_WAITPID) || defined(HAVE_WAIT3)
 # define JOB_SIGS
 #endif
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.43 src/bin/ksh/config.h:1.44
--- src/bin/ksh/config.h:1.43	Fri Jun 30 02:13:29 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:20:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.43 2017/06/30 02:13:29 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.44 2017/06/30 02:20:47 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -39,9 +39,6 @@
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 
-/* Define if you have posix signal routines (sigaction(), et. al.) */
-#define POSIX_SIGNALS 1
-
 /* Define to use the fake posix signal routines (sigact.[ch]) */
 /* #undef USE_FAKE_SIGACT */
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:13:29 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h

Log Message:
ksh: Drop support for systems without implementation of EINTR

These systems weren't handled anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.42 -r1.43 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.4 src/bin/ksh/conf-end.h:1.5
--- src/bin/ksh/conf-end.h:1.4	Thu Jun 22 23:59:28 2017
+++ src/bin/ksh/conf-end.h	Fri Jun 30 02:13:29 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.4 2017/06/22 23:59:28 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.4 2017/06/22 23:59:28 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.5 2017/06/30 02:13:29 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -32,18 +32,6 @@
 # undef JOBS /* if no JOB_SIGS, no job control support */
 #endif
 
-/* pdksh assumes system calls return EINTR if a signal happened (this so
- * the signal handler doesn't have to longjmp()).  I don't know if this
- * happens (or can be made to happen) with sigset() et. al. (the bsd41 signal
- * routines), so, the autoconf stuff checks what they do and defines
- * SIGNALS_DONT_INTERRUPT if signals don't interrupt read().
- * If SIGNALS_DONT_INTERRUPT isn't defined and your compiler chokes on this,
- * delete the hash in front of the error (and file a bug report).
- */
-#ifdef SIGNALS_DONT_INTERRUPT
-  # error pdksh needs interruptable system calls.
-#endif /* SIGNALS_DONT_INTERRUPT */
-
 #ifdef HAVE_GCC_FUNC_ATTR
 # define GCC_FUNC_ATTR(x)	__attribute__((x))
 # define GCC_FUNC_ATTR2(x,y)	__attribute__((x,y))

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.42 src/bin/ksh/config.h:1.43
--- src/bin/ksh/config.h:1.42	Fri Jun 30 02:06:59 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:13:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.42 2017/06/30 02:06:59 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.43 2017/06/30 02:13:29 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -45,9 +45,6 @@
 /* Define to use the fake posix signal routines (sigact.[ch]) */
 /* #undef USE_FAKE_SIGACT */
 
-/* Define if signals don't interrupt read() */
-/* #undef SIGNALS_DONT_INTERRUPT */
-
 /* Define if you have bsd versions of the setpgrp() and getpgrp() routines */
 /* #undef BSD_PGRP */
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:06:59 UTC 2017

Modified Files:
src/bin/ksh: config.h eval.c exec.c

Log Message:
ksh: Drop support for systems without handling shebang


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/ksh/config.h
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/eval.c src/bin/ksh/exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.41 src/bin/ksh/config.h:1.42
--- src/bin/ksh/config.h:1.41	Fri Jun 30 02:02:41 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:06:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.41 2017/06/30 02:02:41 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.42 2017/06/30 02:06:59 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -36,9 +36,6 @@
 /* Define if you can safely include both  and .  */
 #define TIME_WITH_SYS_TIME 1
 
-/* Define if your kernel doesn't handle scripts starting with #! */
-/* #undef SHARPBANG */
-
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.19 src/bin/ksh/eval.c:1.20
--- src/bin/ksh/eval.c:1.19	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/eval.c	Fri Jun 30 02:06:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.19 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
 #endif
 
 #include 
@@ -95,17 +95,10 @@ eval(ap, f)
 		return ap;
 	XPinit(w, 32);
 	XPput(w, NULL);		/* space for shell name */
-#ifdef	SHARPBANG
-	XPput(w, NULL);		/* and space for one arg */
-#endif
 	while (*ap != NULL)
 		expand(*ap++, , f);
 	XPput(w, NULL);
-#ifdef	SHARPBANG
-	return (char **) XPclose(w) + 2;
-#else
 	return (char **) XPclose(w) + 1;
-#endif
 }
 
 /*
Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.19 src/bin/ksh/exec.c:1.20
--- src/bin/ksh/exec.c:1.19	Thu Jun 22 23:47:29 2017
+++ src/bin/ksh/exec.c	Fri Jun 30 02:06:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
 #endif
 
 
@@ -764,53 +764,6 @@ scriptexec(tp, ap)
 		shellv = __UNCONST(EXECSHELL);
 
 	*tp->args-- = tp->str;
-#ifdef	SHARPBANG
-	{
-		char buf[LINE];
-		register char *cp;
-		register int fd, n;
-
-		buf[0] = '\0';
-		if ((fd = open(tp->str, O_RDONLY)) >= 0) {
-			if ((n = read(fd, buf, LINE - 1)) > 0)
-buf[n] = '\0';
-			(void) close(fd);
-		}
-		if ((buf[0] == '#' && buf[1] == '!' && (cp = [2]))
-		)
-		{
-			while (*cp && (*cp == ' ' || *cp == '\t'))
-cp++;
-			if (*cp && *cp != '\n') {
-char *a0 = cp, *a1 = (char *) 0;
-
-while (*cp && *cp != '\n' && *cp != ' '
-   && *cp != '\t')
-{
-	cp++;
-}
-if (*cp && *cp != '\n') {
-	*cp++ = '\0';
-	while (*cp
-	   && (*cp == ' ' || *cp == '\t'))
-		cp++;
-	if (*cp && *cp != '\n') {
-		a1 = cp;
-		/* all one argument */
-		while (*cp && *cp != '\n')
-			cp++;
-	}
-}
-if (*cp == '\n') {
-	*cp = '\0';
-	if (a1)
-		*tp->args-- = a1;
-	shellv = a0;
-}
-			}
-		}
-	}
-#endif	/* SHARPBANG */
 	*tp->args = shellv;
 
 	execve(tp->args[0], tp->args, ap);



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 02:02:41 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for OSes without POSIX types

Assume available: mode_t, off_t, pid_t, uid_t, rlim_t, sigset_t.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.40 src/bin/ksh/config.h:1.41
--- src/bin/ksh/config.h:1.40	Fri Jun 30 01:56:34 2017
+++ src/bin/ksh/config.h	Fri Jun 30 02:02:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.40 2017/06/30 01:56:34 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.41 2017/06/30 02:02:41 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -17,15 +17,6 @@
 /* Define if on MINIX.  */
 /* #undef _MINIX */
 
-/* Define to `int' if  doesn't define.  */
-/* #undef mode_t */
-
-/* Define to `long' if  doesn't define.  */
-/* #undef off_t */
-
-/* Define to `int' if  doesn't define.  */
-/* #undef pid_t */
-
 /* Define if the system does not provide POSIX.1 features except
with this defined.  */
 /* #undef _POSIX_1_SOURCE */
@@ -45,9 +36,6 @@
 /* Define if you can safely include both  and .  */
 #define TIME_WITH_SYS_TIME 1
 
-/* Define to `int' if  doesn't define.  */
-/* #undef uid_t */
-
 /* Define if your kernel doesn't handle scripts starting with #! */
 /* #undef SHARPBANG */
 
@@ -81,15 +69,9 @@
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 
-/* Define to the type of struct rlimit fields if the rlim_t type is missing */
-/* #undef rlim_t */
-
 /* Define if time() is declared in  */
 #define TIME_DECLARED 1
 
-/* Define to `unsigned' if  doesn't define */
-/* #undef sigset_t */
-
 /* Define if sys_errlist[] and sys_nerr are in the C library */
 #define HAVE_SYS_ERRLIST 1
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 01:56:34 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without 


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.39 src/bin/ksh/config.h:1.40
--- src/bin/ksh/config.h:1.39	Fri Jun 30 01:36:30 2017
+++ src/bin/ksh/config.h	Fri Jun 30 01:56:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.39 2017/06/30 01:36:30 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.40 2017/06/30 01:56:34 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -14,9 +14,6 @@
 /* Define if your struct stat has st_rdev.  */
 #define HAVE_ST_RDEV 1
 
-/* Define if you have  that is POSIX.1 compatible.  */
-#define HAVE_SYS_WAIT_H 1
-
 /* Define if on MINIX.  */
 /* #undef _MINIX */
 
@@ -247,9 +244,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_SYS_TIME_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_SYS_WAIT_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_ULIMIT_H
 



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 01:52:34 UTC 2017

Modified Files:
src/bin/ksh: jobs.c
Removed Files:
src/bin/ksh: ksh_wait.h

Log Message:
ksh: Drop ksh_wait.h that reinvents  (POSIX header)

Switch jobs.c to .

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/jobs.c
cvs rdiff -u -r1.2 -r0 src/bin/ksh/ksh_wait.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.14 src/bin/ksh/jobs.c:1.15
--- src/bin/ksh/jobs.c:1.14	Fri Jun 23 00:29:42 2017
+++ src/bin/ksh/jobs.c	Fri Jun 30 01:52:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -26,13 +26,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.15 2017/06/30 01:52:34 kamil Exp $");
 #endif
 
+#include 
 
 #include "sh.h"
 #include "ksh_stat.h"
-#include "ksh_wait.h"
 #include "ksh_times.h"
 #include "tty.h"
 
@@ -103,7 +103,7 @@ typedef struct proc	Proc;
 struct proc {
 	Proc	*next;		/* next process in pipeline (if any) */
 	int	state;
-	WAIT_T	status;		/* wait status */
+	int	status;		/* wait status */
 	pid_t	pid;		/* process id */
 	char	command[48];	/* process command string */
 };
@@ -469,7 +469,7 @@ exchild(t, flags, close_fd)
 	p = new_proc();
 	p->next = (Proc *) 0;
 	p->state = PRUNNING;
-	WSTATUS(p->status) = 0;
+	p->status = 0;
 	p->pid = 0;
 
 	/* link process into jobs list */
@@ -891,7 +891,7 @@ j_resume(cp, bg)
 	for (p = j->proc_list; p != (Proc *) 0; p = p->next) {
 		if (p->state == PSTOPPED) {
 			p->state = PRUNNING;
-			WSTATUS(p->status) = 0;
+			p->status = 0;
 			running = 1;
 		}
 		shprintf("%s%s", p->command, p->next ? "| " : null);
@@ -1212,7 +1212,7 @@ j_waitj(j, flags, where)
 	j->flags &= ~(JF_WAITING|JF_W_ASYNCNOTIFY);
 
 	if (j->flags & JF_FG) {
-		WAIT_T	status;
+		int	status;
 
 		j->flags &= ~JF_FG;
 #ifdef TTY_PGRP
@@ -1317,7 +1317,7 @@ j_sigchld(sig)
 	Job		*j;
 	Proc		UNINITIALIZED(*p);
 	int		pid;
-	WAIT_T		status;
+	int		status;
 	struct tms	t0, t1;
 
 #ifdef JOB_SIGS
@@ -1336,7 +1336,7 @@ j_sigchld(sig)
 	ksh_times();
 	do {
 #ifdef JOB_SIGS
-		pid = ksh_waitpid(-1, , (WNOHANG|WUNTRACED));
+		pid = waitpid(-1, , (WNOHANG|WUNTRACED));
 #else /* JOB_SIGS */
 		pid = wait();
 #endif /* JOB_SIGS */
@@ -1513,7 +1513,7 @@ j_print(j, how, shf)
 {
 	Proc	*p;
 	int	state;
-	WAIT_T	status;
+	int	status;
 	int	coredumped;
 	char	jobchar = ' ';
 	char	buf[64];
@@ -1556,7 +1556,7 @@ j_print(j, how, shf)
 	WEXITSTATUS(p->status));
 			break;
 		case PSIGNALLED:
-			if (WIFCORED(p->status))
+			if (WCOREDUMP(p->status))
 coredumped = 1;
 			/* kludge for not reporting `normal termination signals'
 			 * (ie, SIGINT, SIGPIPE)
@@ -1597,8 +1597,7 @@ j_print(j, how, shf)
 		state = p->state;
 		status = p->status;
 		p = p->next;
-		while (p && p->state == state
-		   && WSTATUS(p->status) == WSTATUS(status))
+		while (p && p->state == state && p->status == status)
 		{
 			if (how == JP_LONG)
 shf_fprintf(shf, "%s%5d %-20s %s%s", filler, p->pid,



CVS commit: src/bin/ksh

2017-06-29 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 30 01:36:30 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without gid_t


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.38 src/bin/ksh/config.h:1.39
--- src/bin/ksh/config.h:1.38	Fri Jun 23 00:35:20 2017
+++ src/bin/ksh/config.h	Fri Jun 30 01:36:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.38 2017/06/23 00:35:20 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.39 2017/06/30 01:36:30 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -11,9 +11,6 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
-/* Define to `int' if  doesn't define.  */
-/* #undef gid_t */
-
 /* Define if your struct stat has st_rdev.  */
 #define HAVE_ST_RDEV 1
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:35:20 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems without clock_t type


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.37 src/bin/ksh/config.h:1.38
--- src/bin/ksh/config.h:1.37	Fri Jun 23 00:29:42 2017
+++ src/bin/ksh/config.h	Fri Jun 23 00:35:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.37 2017/06/23 00:29:42 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.38 2017/06/23 00:35:20 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -87,9 +87,6 @@
 /* Define if C compiler groks __attribute__((...)) (const, noreturn, format) */
 #define HAVE_GCC_FUNC_ATTR 1
 
-/* Define to 32-bit signed integer type if  doesn't define */
-/* #undef clock_t */
-
 /* Define to the type of struct rlimit fields if the rlim_t type is missing */
 /* #undef rlim_t */
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:29:42 UTC 2017

Modified Files:
src/bin/ksh: config.h jobs.c sh.h

Log Message:
ksh: Replace homegrown int_least32_t with the C99 version


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/ksh/config.h
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/jobs.c
cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.36 src/bin/ksh/config.h:1.37
--- src/bin/ksh/config.h:1.36	Fri Jun 23 00:20:22 2017
+++ src/bin/ksh/config.h	Fri Jun 23 00:29:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.36 2017/06/23 00:20:22 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.37 2017/06/23 00:29:42 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -172,12 +172,6 @@
 /* Include game-of-life? */
 /* #undef SILLY */
 
-/* The number of bytes in a int.  */
-#define SIZEOF_INT 4
-
-/* The number of bytes in a long.  */
-#define SIZEOF_LONG 4
-
 /* Define if you have the _setjmp function.  */
 #define HAVE__SETJMP
 

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.13 src/bin/ksh/jobs.c:1.14
--- src/bin/ksh/jobs.c:1.13	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/jobs.c	Fri Jun 23 00:29:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.13 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $	*/
 
 /*
  * Process and job control
@@ -26,7 +26,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: jobs.c,v 1.13 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.14 2017/06/23 00:29:42 kamil Exp $");
 #endif
 
 
@@ -142,7 +142,7 @@ struct job {
 	int	status;		/* exit status of last process */
 	pid_t	pgrp;		/* process group of job */
 	pid_t	ppid;		/* pid of process that forked job */
-	INT32	age;		/* number of jobs started */
+	int_least32_t	age;	/* number of jobs started */
 	clock_t	systime;	/* system time used by job */
 	clock_t	usrtime;	/* user time used by job */
 	Proc	*proc_list;	/* process list */
@@ -183,7 +183,7 @@ static Job		*async_job;
 static pid_t		async_pid;
 
 static int		nzombie;	/* # of zombies owned by this process */
-static INT32		njobs;		/* # of jobs started */
+static int_least32_t	njobs;		/* # of jobs started */
 static int		child_max;	/* CHILD_MAX */
 
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.28 src/bin/ksh/sh.h:1.29
--- src/bin/ksh/sh.h:1.28	Fri Jun 23 00:18:01 2017
+++ src/bin/ksh/sh.h	Fri Jun 23 00:29:42 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.29 2017/06/23 00:29:42 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $ */
+/* $Id: sh.h,v 1.29 2017/06/23 00:29:42 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #ifndef O_ACCMODE
 # define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
@@ -118,20 +119,6 @@ typedef	RETSIGTYPE (*handler_t) ARGS((in
 # define ksh_jmp_buf		jmp_buf
 #endif /* HAVE_SIGSETJMP */
 
-/* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined
- * by autoconf (assumes an 8 bit byte, but I'm not concerned).
- * NOTE: INT32 may end up being more than 32 bits.
- */
-#if SIZEOF_INT >= 4
-# define INT32	int
-#else /* SIZEOF_INT */
-# if SIZEOF_LONG >= 4
-#  define INT32	long
-# else /* SIZEOF_LONG */
-   #error cannot find 32 bit type...
-# endif /* SIZEOF_LONG */
-#endif /* SIZEOF_INT */
-
 /* end of common headers */
 
 /* Stop gcc and lint from complaining about possibly uninitialized variables */
@@ -187,7 +174,7 @@ typedef int bool_t;
 #define	BIT(i)	(1<<(i))	/* define bit in flag */
 
 /* Table flag type - needs > 16 and < 32 bits */
-typedef INT32 Tflag;
+typedef int_least32_t Tflag;
 
 #define	NUFILE	32		/* Number of user-accessible files */
 #define	FDBASE	10		/* First file usable by Shell */
@@ -495,7 +482,7 @@ EXTERN Getopt user_opt;		/* parsing stat
 #ifdef KSH
 /* This for co-processes */
 
-typedef INT32 Coproc_id; /* something that won't (realisticly) wrap */
+typedef int_least32_t Coproc_id; /* something that won't (realisticly) wrap */
 struct coproc {
 	int	read;		/* pipe from co-process's stdout */
 	int	readw;		/* other side of read (saved temporarily) */



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:20:23 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Drop support for systems that return void for closedir(2)


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.35 src/bin/ksh/config.h:1.36
--- src/bin/ksh/config.h:1.35	Fri Jun 23 00:00:58 2017
+++ src/bin/ksh/config.h	Fri Jun 23 00:20:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.35 2017/06/23 00:00:58 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.36 2017/06/23 00:20:22 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -54,9 +54,6 @@
 /* Define to `int' if  doesn't define.  */
 /* #undef uid_t */
 
-/* Define if the closedir function returns void instead of int.  */
-/* #undef VOID_CLOSEDIR */
-
 /* Define if your kernel doesn't handle scripts starting with #! */
 /* #undef SHARPBANG */
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:18:01 UTC 2017

Modified Files:
src/bin/ksh: io.c lex.c sh.h shf.c tree.c

Log Message:
ksh: Use ANSI C varargs, drop support for older version 


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/io.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/lex.c
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/sh.h
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/shf.c
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/io.c
diff -u src/bin/ksh/io.c:1.13 src/bin/ksh/io.c:1.14
--- src/bin/ksh/io.c:1.13	Thu Jun 22 19:41:07 2017
+++ src/bin/ksh/io.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.13 2017/06/22 19:41:07 kamil Exp $	*/
+/*	$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * shell buffered IO and formatted output
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.13 2017/06/22 19:41:07 kamil Exp $");
+__RCSID("$NetBSD: io.c,v 1.14 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -37,7 +37,7 @@ errorf(fmt, va_alist)
 	exstat = 1;
 	if (*fmt) {
 		error_prefix(TRUE);
-		SH_VA_START(va, fmt);
+		va_start(va, fmt);
 		shf_vfprintf(shl_out, fmt, va);
 		va_end(va);
 		shf_putchar('\n', shl_out);
@@ -60,7 +60,7 @@ warningf(fileline, fmt, va_alist)
 	va_list va;
 
 	error_prefix(fileline);
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	shf_putchar('\n', shl_out);
@@ -88,7 +88,7 @@ bi_errorf(fmt, va_alist)
 		/* not set when main() calls parse_args() */
 		if (builtin_argv0)
 			shf_fprintf(shl_out, "%s: ", builtin_argv0);
-		SH_VA_START(va, fmt);
+		va_start(va, fmt);
 		shf_vfprintf(shl_out, fmt, va);
 		va_end(va);
 		shf_putchar('\n', shl_out);
@@ -121,7 +121,7 @@ internal_errorf(jump, fmt, va_alist)
 
 	error_prefix(TRUE);
 	shf_fprintf(shl_out, "internal error: ");
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	shf_putchar('\n', shl_out);
@@ -160,7 +160,7 @@ shellf(fmt, va_alist)
 
 	if (!initio_done) /* shl_out may not be set up yet... */
 		return;
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	shf_flush(shl_out);
@@ -180,7 +180,7 @@ shprintf(fmt, va_alist)
 
 	if (!shl_stdout_ok)
 		internal_errorf(1, "shl_stdout not valid");
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_stdout, fmt, va);
 	va_end(va);
 }
@@ -216,7 +216,7 @@ kshdebug_printf_(fmt, va_alist)
 
 	if (!kshdebug_shf)
 		return;
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_fprintf(kshdebug_shf, "[%d] ", getpid());
 	shf_vfprintf(kshdebug_shf, fmt, va);
 	va_end(va);

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.18 src/bin/ksh/lex.c:1.19
--- src/bin/ksh/lex.c:1.18	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/lex.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.18 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.18 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: lex.c,v 1.19 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -852,7 +852,7 @@ yyerror(fmt, va_alist)
 	source->str = null;	/* zap pending input */
 
 	error_prefix(TRUE);
-	SH_VA_START(va, fmt);
+	va_start(va, fmt);
 	shf_vfprintf(shl_out, fmt, va);
 	va_end(va);
 	errorf("%s", null);

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.27 src/bin/ksh/sh.h:1.28
--- src/bin/ksh/sh.h:1.27	Fri Jun 23 00:09:36 2017
+++ src/bin/ksh/sh.h	Fri Jun 23 00:18:01 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.27 2017/06/23 00:09:36 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.27 2017/06/23 00:09:36 kamil Exp $ */
+/* $Id: sh.h,v 1.28 2017/06/23 00:18:01 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -23,15 +23,7 @@
 #include 
 #include 
 #include 
-
-#ifdef HAVE_PROTOTYPES
-# include 
-# define SH_VA_START(va, argn) va_start(va, argn)
-#else
-# include 
-# define SH_VA_START(va, argn) va_start(va)
-#endif /* HAVE_PROTOTYPES */
-
+#include 
 #include 
 #include 
 

Index: src/bin/ksh/shf.c
diff -u src/bin/ksh/shf.c:1.10 src/bin/ksh/shf.c:1.11
--- src/bin/ksh/shf.c:1.10	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/shf.c	Fri Jun 23 00:18:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: shf.c,v 1.10 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: shf.c,v 1.11 2017/06/23 00:18:01 kamil Exp $	*/
 
 /*
  *  Shell file I/O routines
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: shf.c,v 1.10 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: shf.c,v 1.11 2017/06/23 00:18:01 kamil Exp $");
 #endif
 
 
@@ -770,7 +770,7 @@ shf_fprintf(shf, fmt, va_alist)
 	

CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:11:01 UTC 2017

Modified Files:
src/bin/ksh: tty.c

Log Message:
ksh: Remove remnant hack for SCO UNIX in tty code


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/tty.c
diff -u src/bin/ksh/tty.c:1.6 src/bin/ksh/tty.c:1.7
--- src/bin/ksh/tty.c:1.6	Fri Jun 23 00:09:36 2017
+++ src/bin/ksh/tty.c	Fri Jun 23 00:11:01 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: tty.c,v 1.6 2017/06/23 00:09:36 kamil Exp $	*/
+/*	$NetBSD: tty.c,v 1.7 2017/06/23 00:11:01 kamil Exp $	*/
 
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: tty.c,v 1.6 2017/06/23 00:09:36 kamil Exp $");
+__RCSID("$NetBSD: tty.c,v 1.7 2017/06/23 00:11:01 kamil Exp $");
 #endif
 
 
@@ -109,8 +109,6 @@ tty_init(init_ttystate)
 	}
 	tty_devtty = 1;
 
-	/* SCO can't job control on /dev/tty, so don't try... */
-#if !defined(__SCO__)
 	if ((tfd = open(devtty, O_RDWR, 0)) < 0) {
 		if (tfd < 0) {
 			tty_devtty = 0;
@@ -119,9 +117,6 @@ tty_init(init_ttystate)
 devtty, strerror(errno));
 		}
 	}
-#else /* !__SCO__ */
-	tfd = -1;
-#endif /* __SCO__ */
 
 	if (tfd < 0) {
 		do_close = 0;



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:09:36 UTC 2017

Modified Files:
src/bin/ksh: sh.h tty.c

Log Message:
ksh: Remove support for NeXT Operating System


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/bin/ksh/sh.h
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.26 src/bin/ksh/sh.h:1.27
--- src/bin/ksh/sh.h:1.26	Thu Jun 22 23:50:24 2017
+++ src/bin/ksh/sh.h	Fri Jun 23 00:09:36 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.26 2017/06/22 23:50:24 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.27 2017/06/23 00:09:36 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.26 2017/06/22 23:50:24 kamil Exp $ */
+/* $Id: sh.h,v 1.27 2017/06/23 00:09:36 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -553,11 +553,7 @@ EXTERN	int	x_cols I__(80);	/* tty column
 
 /* Determine the location of the system (common) profile */
 #ifndef KSH_SYSTEM_PROFILE
-# ifdef __NeXT
-#  define KSH_SYSTEM_PROFILE "/etc/profile.std"
-# else /* __NeXT */
-#  define KSH_SYSTEM_PROFILE "/etc/profile"
-# endif /* __NeXT */
+# define KSH_SYSTEM_PROFILE "/etc/profile"
 #endif /* KSH_SYSTEM_PROFILE */
 
 /* Used by v_evaluate() and setstr() to control action when error occurs */

Index: src/bin/ksh/tty.c
diff -u src/bin/ksh/tty.c:1.5 src/bin/ksh/tty.c:1.6
--- src/bin/ksh/tty.c:1.5	Fri Jun 23 00:04:20 2017
+++ src/bin/ksh/tty.c	Fri Jun 23 00:09:36 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: tty.c,v 1.5 2017/06/23 00:04:20 kamil Exp $	*/
+/*	$NetBSD: tty.c,v 1.6 2017/06/23 00:09:36 kamil Exp $	*/
 
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: tty.c,v 1.5 2017/06/23 00:04:20 kamil Exp $");
+__RCSID("$NetBSD: tty.c,v 1.6 2017/06/23 00:09:36 kamil Exp $");
 #endif
 
 
@@ -112,22 +112,6 @@ tty_init(init_ttystate)
 	/* SCO can't job control on /dev/tty, so don't try... */
 #if !defined(__SCO__)
 	if ((tfd = open(devtty, O_RDWR, 0)) < 0) {
-#ifdef __NeXT
-		/* rlogin on NeXT boxes does not set up the controlling tty,
-		 * so force it to be done here...
-		 */
-		{
-			extern char *ttyname ARGS((int));
-			char *s = ttyname(isatty(2) ? 2 : 0);
-			int fd;
-
-			if (s && (fd = open(s, O_RDWR, 0)) >= 0) {
-close(fd);
-tfd = open(devtty, O_RDWR, 0);
-			}
-		}
-#endif /* __NeXT */
-
 		if (tfd < 0) {
 			tty_devtty = 0;
 			warningf(FALSE,



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:07:15 UTC 2017

Modified Files:
src/bin/ksh: sigact.c

Log Message:
ksh: Drop the latest ifdef for BSD4.1 and eliminate dead code around it


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/sigact.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/sigact.c
diff -u src/bin/ksh/sigact.c:1.6 src/bin/ksh/sigact.c:1.7
--- src/bin/ksh/sigact.c:1.6	Thu Jun 22 23:59:28 2017
+++ src/bin/ksh/sigact.c	Fri Jun 23 00:07:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigact.c,v 1.6 2017/06/22 23:59:28 kamil Exp $	*/
+/*	$NetBSD: sigact.c,v 1.7 2017/06/23 00:07:15 kamil Exp $	*/
 
 /* NAME:
  *  sigact.c - fake sigaction(2)
@@ -141,7 +141,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: sigact.c,v 1.6 2017/06/22 23:59:28 kamil Exp $");
+__RCSID("$NetBSD: sigact.c,v 1.7 2017/06/23 00:07:15 kamil Exp $");
 #endif
 
 
@@ -169,28 +169,6 @@ __RCSID("$NetBSD: sigact.c,v 1.6 2017/06
 
 #define USE_SIGMASK
 
-/*
- * if we haven't been told,
- * try and guess what we should implement with.
- */
-#if !defined(USE_SIGSET) && !defined(USE_SIGMASK) && !defined(USE_SIGNAL)
-# if defined(sigmask) || defined(BSD) || defined(_BSD) && !defined(BSD41)
-#   define USE_SIGMASK
-# else
-#   ifndef NO_SIGSET
-# define USE_SIGSET
-#   else
-# define USE_SIGNAL
-#   endif
-# endif
-#endif
-/*
- * if we still don't know, we're in trouble
- */
-#if !defined(USE_SIGSET) && !defined(USE_SIGMASK) && !defined(USE_SIGNAL)
-error must know what to implement with
-#endif
-
 #include "sigact.h"
 
 /*



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:04:20 UTC 2017

Modified Files:
src/bin/ksh: tty.c

Log Message:
ksh: Drop BSD4.3 temporary hack in tty code


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/tty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/tty.c
diff -u src/bin/ksh/tty.c:1.4 src/bin/ksh/tty.c:1.5
--- src/bin/ksh/tty.c:1.4	Mon Jun 23 11:39:06 2003
+++ src/bin/ksh/tty.c	Fri Jun 23 00:04:20 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: tty.c,v 1.4 2003/06/23 11:39:06 agc Exp $	*/
+/*	$NetBSD: tty.c,v 1.5 2017/06/23 00:04:20 kamil Exp $	*/
 
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: tty.c,v 1.4 2003/06/23 11:39:06 agc Exp $");
+__RCSID("$NetBSD: tty.c,v 1.5 2017/06/23 00:04:20 kamil Exp $");
 #endif
 
 
@@ -74,16 +74,6 @@ set_tty(fd, ts, flags)
 			ret = -1;
 #   endif
 #  else /* HAVE_TERMIO_H */
-#   if defined(__mips) && (defined(_SYSTYPE_BSD43) || defined(__SYSTYPE_BSD43))
-	/* Under RISC/os 5.00, bsd43 environment, after a tty driver
-	 * generated interrupt (eg, INTR, TSTP), all output to tty is
-	 * lost until a SETP is done (there must be a better way of
-	 * doing this...).
-	 */
-	if (flags & TF_MIPSKLUDGE)
-		ret = ioctl(fd, TIOCSETP, >sgttyb);
-	else
-#   endif /* _SYSTYPE_BSD43 */
 	ret = ioctl(fd, TIOCSETN, >sgttyb);
 #   ifdef TIOCGATC
 	if (ioctl(fd, TIOCSATC, >lchars) < 0)
@@ -138,15 +128,12 @@ tty_init(init_ttystate)
 		}
 #endif /* __NeXT */
 
-/* X11R5 xterm on mips doesn't set controlling tty properly - temporary hack */
-# if !defined(__mips) || !(defined(_SYSTYPE_BSD43) || defined(__SYSTYPE_BSD43))
 		if (tfd < 0) {
 			tty_devtty = 0;
 			warningf(FALSE,
 "No controlling tty (open %s: %s)",
 devtty, strerror(errno));
 		}
-# endif /* __mips  */
 	}
 #else /* !__SCO__ */
 	tfd = -1;



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Jun 23 00:00:58 UTC 2017

Modified Files:
src/bin/ksh: config.h trap.c

Log Message:
ksh: Drop support for UNIX V7-style signal routines


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/ksh/config.h
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.34 src/bin/ksh/config.h:1.35
--- src/bin/ksh/config.h:1.34	Thu Jun 22 23:59:28 2017
+++ src/bin/ksh/config.h	Fri Jun 23 00:00:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.34 2017/06/22 23:59:28 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.35 2017/06/23 00:00:58 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -66,9 +66,6 @@
 /* Define if you have posix signal routines (sigaction(), et. al.) */
 #define POSIX_SIGNALS 1
 
-/* Define if you have v7 signal routines (signal(), signal reset on delivery) */
-/* #undef V7_SIGNALS */
-
 /* Define to use the fake posix signal routines (sigact.[ch]) */
 /* #undef USE_FAKE_SIGACT */
 

Index: src/bin/ksh/trap.c
diff -u src/bin/ksh/trap.c:1.11 src/bin/ksh/trap.c:1.12
--- src/bin/ksh/trap.c:1.11	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/trap.c	Fri Jun 23 00:00:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.11 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: trap.c,v 1.12 2017/06/23 00:00:58 kamil Exp $	*/
 
 /*
  * signal handling
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: trap.c,v 1.11 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: trap.c,v 1.12 2017/06/23 00:00:58 kamil Exp $");
 #endif
 
 #include "sh.h"
@@ -141,10 +141,7 @@ trapsig(i)
 	}
 	if (p->shtrap)
 		(*p->shtrap)(i);
-#ifdef V7_SIGNALS
-	if (sigtraps[i].cursig == trapsig) /* this for SIGCHLD,SIGALRM */
-		sigaction(i, _trap, (struct sigaction *) 0);
-#endif /* V7_SIGNALS */
+
 	errno = errno_;
 	return RETSIGVAL;
 }



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:59:29 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h sigact.c

Log Message:
ksh: Drop fallback for BSD4.2 signal routines


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/config.h
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/sigact.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.3 src/bin/ksh/conf-end.h:1.4
--- src/bin/ksh/conf-end.h:1.3	Thu Jun 22 23:54:13 2017
+++ src/bin/ksh/conf-end.h	Thu Jun 22 23:59:28 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.3 2017/06/22 23:54:13 kamil Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.4 2017/06/22 23:59:28 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.3 2017/06/22 23:54:13 kamil Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.4 2017/06/22 23:59:28 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -24,7 +24,7 @@
 
 /* Can we safely catch sigchld and wait for processes? */
 #if (defined(HAVE_WAITPID) || defined(HAVE_WAIT3)) \
-&& (defined(POSIX_SIGNALS) || defined(BSD42_SIGNALS))
+&& (defined(POSIX_SIGNALS))
 # define JOB_SIGS
 #endif
 

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.33 src/bin/ksh/config.h:1.34
--- src/bin/ksh/config.h:1.33	Thu Jun 22 23:56:24 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:59:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.33 2017/06/22 23:56:24 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.34 2017/06/22 23:59:28 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -66,9 +66,6 @@
 /* Define if you have posix signal routines (sigaction(), et. al.) */
 #define POSIX_SIGNALS 1
 
-/* Define if you have BSD4.2 signal routines (sigsetmask(), et. al.) */
-/* #undef BSD42_SIGNALS */
-
 /* Define if you have v7 signal routines (signal(), signal reset on delivery) */
 /* #undef V7_SIGNALS */
 

Index: src/bin/ksh/sigact.c
diff -u src/bin/ksh/sigact.c:1.5 src/bin/ksh/sigact.c:1.6
--- src/bin/ksh/sigact.c:1.5	Thu Jun 22 23:56:24 2017
+++ src/bin/ksh/sigact.c	Thu Jun 22 23:59:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigact.c,v 1.5 2017/06/22 23:56:24 kamil Exp $	*/
+/*	$NetBSD: sigact.c,v 1.6 2017/06/22 23:59:28 kamil Exp $	*/
 
 /* NAME:
  *  sigact.c - fake sigaction(2)
@@ -141,7 +141,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: sigact.c,v 1.5 2017/06/22 23:56:24 kamil Exp $");
+__RCSID("$NetBSD: sigact.c,v 1.6 2017/06/22 23:59:28 kamil Exp $");
 #endif
 
 
@@ -167,12 +167,7 @@ __RCSID("$NetBSD: sigact.c,v 1.5 2017/06
 #ifdef USE_FAKE_SIGACT /* let autoconf decide.. */
 /* #if !defined(SA_NOCLDSTOP) || defined(_SIGACT_H) || defined(USE_SIGNAL) || defined(USE_SIGSET) || defined(USE_SIGMASK) */
 
-/* Let autoconf decide which to use */
-#ifdef BSD42_SIGNALS
-# define USE_SIGMASK
-#else
-# define USE_SIGNAL
-#endif /* BSD42_SIGNALS */
+#define USE_SIGMASK
 
 /*
  * if we haven't been told,



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:56:24 UTC 2017

Modified Files:
src/bin/ksh: config.h sigact.c

Log Message:
ksh: Remove fallback to BSD4.1 signal routines


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/config.h
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/sigact.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.32 src/bin/ksh/config.h:1.33
--- src/bin/ksh/config.h:1.32	Thu Jun 22 23:54:13 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:56:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.32 2017/06/22 23:54:13 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.33 2017/06/22 23:56:24 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -69,9 +69,6 @@
 /* Define if you have BSD4.2 signal routines (sigsetmask(), et. al.) */
 /* #undef BSD42_SIGNALS */
 
-/* Define if you have BSD4.1 signal routines (sigset(), et. al.) */
-/* #undef BSD41_SIGNALS */
-
 /* Define if you have v7 signal routines (signal(), signal reset on delivery) */
 /* #undef V7_SIGNALS */
 

Index: src/bin/ksh/sigact.c
diff -u src/bin/ksh/sigact.c:1.4 src/bin/ksh/sigact.c:1.5
--- src/bin/ksh/sigact.c:1.4	Mon Jun 23 11:39:03 2003
+++ src/bin/ksh/sigact.c	Thu Jun 22 23:56:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigact.c,v 1.4 2003/06/23 11:39:03 agc Exp $	*/
+/*	$NetBSD: sigact.c,v 1.5 2017/06/22 23:56:24 kamil Exp $	*/
 
 /* NAME:
  *  sigact.c - fake sigaction(2)
@@ -141,7 +141,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: sigact.c,v 1.4 2003/06/23 11:39:03 agc Exp $");
+__RCSID("$NetBSD: sigact.c,v 1.5 2017/06/22 23:56:24 kamil Exp $");
 #endif
 
 
@@ -171,11 +171,7 @@ __RCSID("$NetBSD: sigact.c,v 1.4 2003/06
 #ifdef BSD42_SIGNALS
 # define USE_SIGMASK
 #else
-# ifdef BSD41_SIGNALS
-#  define USE_SIGSET
-# else
-#  define USE_SIGNAL
-# endif
+# define USE_SIGNAL
 #endif /* BSD42_SIGNALS */
 
 /*



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:54:13 UTC 2017

Modified Files:
src/bin/ksh: conf-end.h config.h

Log Message:
ksh: Drop support for systems without mmap(2)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/bin/ksh/conf-end.h
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/conf-end.h
diff -u src/bin/ksh/conf-end.h:1.2 src/bin/ksh/conf-end.h:1.3
--- src/bin/ksh/conf-end.h:1.2	Sun Jan 12 19:11:43 1997
+++ src/bin/ksh/conf-end.h	Thu Jun 22 23:54:13 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: conf-end.h,v 1.2 1997/01/12 19:11:43 tls Exp $	*/
+/*	$NetBSD: conf-end.h,v 1.3 2017/06/22 23:54:13 kamil Exp $	*/
 
 /*
  * End of configuration stuff for PD ksh.
  *
- * RCSid: $NetBSD: conf-end.h,v 1.2 1997/01/12 19:11:43 tls Exp $
+ * RCSid: $NetBSD: conf-end.h,v 1.3 2017/06/22 23:54:13 kamil Exp $
  */
 
 #if defined(EMACS) || defined(VI)
@@ -17,11 +17,7 @@
 # define HISTORY
 #endif /* EDIT */
 
-/*
- * if you don't have mmap() you can't use Peter Collinson's history
- * mechanism.  If that is the case, then define EASY_HISTORY
- */
-#if defined(HISTORY) && (!defined(COMPLEX_HISTORY) || !defined(HAVE_MMAP) || !defined(HAVE_FLOCK))
+#if defined(HISTORY) && (!defined(COMPLEX_HISTORY) || !defined(HAVE_FLOCK))
 # undef COMPLEX_HISTORY
 # define EASY_HISTORY			/* sjg's trivial history file */
 #endif

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.31 src/bin/ksh/config.h:1.32
--- src/bin/ksh/config.h:1.31	Thu Jun 22 23:50:24 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:54:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.31 2017/06/22 23:50:24 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.32 2017/06/22 23:54:13 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -14,9 +14,6 @@
 /* Define to `int' if  doesn't define.  */
 /* #undef gid_t */
 
-/* Define if you have a working `mmap' system call.  */
-#define HAVE_MMAP 1
-
 /* Define if your struct stat has st_rdev.  */
 #define HAVE_ST_RDEV 1
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:50:25 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without dup2(2)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/ksh/config.h
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.30 src/bin/ksh/config.h:1.31
--- src/bin/ksh/config.h:1.30	Thu Jun 22 23:47:29 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:50:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.30 2017/06/22 23:47:29 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.31 2017/06/22 23:50:24 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -138,9 +138,6 @@
 /* Define if opendir() will open non-directory files */
 /* #undef OPENDIR_DOES_NONDIR */
 
-/* Define if you have a dup2() function in your C library */
-#define	HAVE_DUP2 1
-
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.25 src/bin/ksh/sh.h:1.26
--- src/bin/ksh/sh.h:1.25	Thu Jun 22 23:47:29 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:50:24 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.25 2017/06/22 23:47:29 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.26 2017/06/22 23:50:24 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.25 2017/06/22 23:47:29 kamil Exp $ */
+/* $Id: sh.h,v 1.26 2017/06/22 23:50:24 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -126,10 +126,6 @@ typedef	RETSIGTYPE (*handler_t) ARGS((in
 # define ksh_jmp_buf		jmp_buf
 #endif /* HAVE_SIGSETJMP */
 
-#ifndef HAVE_DUP2
-extern int dup2 ARGS((int, int));
-#endif /* !HAVE_DUP2 */
-
 /* Find a integer type that is at least 32 bits (or die) - SIZEOF_* defined
  * by autoconf (assumes an 8 bit byte, but I'm not concerned).
  * NOTE: INT32 may end up being more than 32 bits.



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:47:29 UTC 2017

Modified Files:
src/bin/ksh: config.h exec.c sh.h

Log Message:
ksh: Drop support for ISC UNIX


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/ksh/config.h
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/exec.c
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.29 src/bin/ksh/config.h:1.30
--- src/bin/ksh/config.h:1.29	Thu Jun 22 23:38:49 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:47:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.29 2017/06/22 23:38:49 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.30 2017/06/22 23:47:29 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -144,9 +144,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if you arg running ISC unix */
-/* #undef OS_ISC */
-
 /* Define if you have a POSIX.1 compatible  */
 #define POSIX_SYS_WAIT 1
 

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.18 src/bin/ksh/exec.c:1.19
--- src/bin/ksh/exec.c:1.18	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/exec.c	Thu Jun 22 23:47:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.18 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.18 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: exec.c,v 1.19 2017/06/22 23:47:29 kamil Exp $");
 #endif
 
 
@@ -420,7 +420,7 @@ execute(t, flags)
 #endif
 		restoresigs();
 		cleanup_proc_env();
-		ksh_execve(t->str, t->args, ap, flags);
+		execve(t->str, t->args, ap);
 		if (errno == ENOEXEC)
 			scriptexec(t, ap);
 		else
@@ -813,7 +813,7 @@ scriptexec(tp, ap)
 #endif	/* SHARPBANG */
 	*tp->args = shellv;
 
-	ksh_execve(tp->args[0], tp->args, ap, 0);
+	execve(tp->args[0], tp->args, ap);
 
 	/* report both the program that was run and the bogus shell */
 	errorf("%s: %s: %s", tp->str, shellv, strerror(errno));

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.24 src/bin/ksh/sh.h:1.25
--- src/bin/ksh/sh.h:1.24	Thu Jun 22 23:42:35 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:47:29 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.24 2017/06/22 23:42:35 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.25 2017/06/22 23:47:29 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.24 2017/06/22 23:42:35 kamil Exp $ */
+/* $Id: sh.h,v 1.25 2017/06/22 23:47:29 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -108,19 +108,6 @@ typedef	RETSIGTYPE (*handler_t) ARGS((in
 # define killpg(p, s)	kill(-(p), (s))
 #endif /* !HAVE_KILLPG */
 
-/* Special cases for execve(2) */
-# if defined(OS_ISC) && defined(_POSIX_SOURCE)
-/* Kludge for ISC 3.2 (and other versions?) so programs will run correctly.  */
-#  define ksh_execve(p, av, ev, flags) \
-do { \
-	__setostype(0); \
-	execve(p, av, ev); \
-	__setostype(1); \
-} while (0)
-# else /* OS_ISC && _POSIX */
-#  define ksh_execve(p, av, ev, flags)	execve(p, av, ev)
-# endif /* OS_ISC && _POSIX */
-
 /* this is a hang-over from older versions of the os2 port */
 #define ksh_dupbase(fd, base) fcntl(fd, F_DUPFD, base)
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:42:35 UTC 2017

Modified Files:
src/bin/ksh: sh.h

Log Message:
ksh: Drop support for systems without offsetof(3)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.23 src/bin/ksh/sh.h:1.24
--- src/bin/ksh/sh.h:1.23	Thu Jun 22 23:38:49 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:42:35 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.23 2017/06/22 23:38:49 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.24 2017/06/22 23:42:35 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.23 2017/06/22 23:38:49 kamil Exp $ */
+/* $Id: sh.h,v 1.24 2017/06/22 23:42:35 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -104,10 +104,6 @@ typedef	RETSIGTYPE (*handler_t) ARGS((in
 # define DEFAULT__PATH DEFAULT_PATH
 #endif /* _PATH_DEFPATH */
 
-#ifndef offsetof
-# define offsetof(type,id) ((size_t)&((type*)NULL)->id)
-#endif
-
 #ifndef HAVE_KILLPG
 # define killpg(p, s)	kill(-(p), (s))
 #endif /* !HAVE_KILLPG */



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:38:49 UTC 2017

Modified Files:
src/bin/ksh: config.h misc.c sh.h

Log Message:
ksh: Drop support for systems without 


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/config.h
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/misc.c
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.28 src/bin/ksh/config.h:1.29
--- src/bin/ksh/config.h:1.28	Thu Jun 22 23:37:00 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:38:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.28 2017/06/22 23:37:00 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.29 2017/06/22 23:38:49 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -259,9 +259,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_DIRENT_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_LIMITS_H 1
-
 /* Define if you have the  header file.  */
 /* #undef HAVE_NDIR_H */
 

Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.21 src/bin/ksh/misc.c:1.22
--- src/bin/ksh/misc.c:1.21	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/misc.c	Thu Jun 22 23:38:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.21 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: misc.c,v 1.22 2017/06/22 23:38:49 kamil Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,15 +6,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: misc.c,v 1.21 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: misc.c,v 1.22 2017/06/22 23:38:49 kamil Exp $");
 #endif
 
 
 #include "sh.h"
 #include 	/* for FILECHCONV */
-#ifdef HAVE_LIMITS_H
-# include 
-#endif
+#include 
 
 #ifndef UCHAR_MAX
 # define UCHAR_MAX	0xFF

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.22 src/bin/ksh/sh.h:1.23
--- src/bin/ksh/sh.h:1.22	Thu Jun 22 23:37:00 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:38:49 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.22 2017/06/22 23:37:00 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.23 2017/06/22 23:38:49 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.22 2017/06/22 23:37:00 kamil Exp $ */
+/* $Id: sh.h,v 1.23 2017/06/22 23:38:49 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -61,9 +61,7 @@
 /* Some machines (eg, FreeBSD 1.1.5) define CLK_TCK in limits.h
  * (ksh_limval.h assumes limits has been included, if available)
  */
-#ifdef HAVE_LIMITS_H
-# include 
-#endif /* HAVE_LIMITS_H */
+#include 
 
 #include 
 #ifdef	NSIG



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:37:00 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without 


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/config.h
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.27 src/bin/ksh/config.h:1.28
--- src/bin/ksh/config.h:1.27	Thu Jun 22 23:33:36 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:37:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.27 2017/06/22 23:33:36 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.28 2017/06/22 23:37:00 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -259,9 +259,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_DIRENT_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_FCNTL_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_LIMITS_H 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.21 src/bin/ksh/sh.h:1.22
--- src/bin/ksh/sh.h:1.21	Thu Jun 22 23:33:36 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:37:00 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.21 2017/06/22 23:33:36 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.22 2017/06/22 23:37:00 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.21 2017/06/22 23:33:36 kamil Exp $ */
+/* $Id: sh.h,v 1.22 2017/06/22 23:37:00 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -33,12 +33,8 @@
 #endif /* HAVE_PROTOTYPES */
 
 #include 
+#include 
 
-#ifdef HAVE_FCNTL_H
-# include 
-#else
-# include 
-#endif /* HAVE_FCNTL_H */
 #ifndef O_ACCMODE
 # define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
 #endif /* !O_ACCMODE */



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:33:36 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without memmove(3) and stop using bcopy(3)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/bin/ksh/config.h
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.26 src/bin/ksh/config.h:1.27
--- src/bin/ksh/config.h:1.26	Thu Jun 22 23:30:42 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:33:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.26 2017/06/22 23:30:42 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.27 2017/06/22 23:33:36 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -126,12 +126,6 @@
 /* Define if you have a sane  header file */
 #define HAVE_TERMIOS_H 1
 
-/* Define if you have a memmove() function in your C library */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have a bcopy() function in your C library */
-#define HAVE_BCOPY
-
 /* Define if you have a lstat() function in your C library */
 #define HAVE_LSTAT 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.20 src/bin/ksh/sh.h:1.21
--- src/bin/ksh/sh.h:1.20	Thu Jun 22 23:30:42 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:33:36 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.20 2017/06/22 23:30:42 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.21 2017/06/22 23:33:36 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.20 2017/06/22 23:30:42 kamil Exp $ */
+/* $Id: sh.h,v 1.21 2017/06/22 23:33:36 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -24,14 +24,6 @@
 #include 
 #include 
 
-#ifndef HAVE_MEMMOVE
-# ifdef HAVE_BCOPY
-#  define memmove(d, s, n)	bcopy(s, d, n)
-# else
-void *memmove ARGS((void *d, const void *s, size_t n));
-# endif
-#endif /* HAVE_MEMMOVE */
-
 #ifdef HAVE_PROTOTYPES
 # include 
 # define SH_VA_START(va, argn) va_start(va, argn)



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:30:42 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without memset(3)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/config.h
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.25 src/bin/ksh/config.h:1.26
--- src/bin/ksh/config.h:1.25	Thu Jun 22 23:29:35 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:30:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.25 2017/06/22 23:29:35 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.26 2017/06/22 23:30:42 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -126,9 +126,6 @@
 /* Define if you have a sane  header file */
 #define HAVE_TERMIOS_H 1
 
-/* Define if you have a memset() function in your C library */
-#define HAVE_MEMSET 1
-
 /* Define if you have a memmove() function in your C library */
 #define HAVE_MEMMOVE 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.19 src/bin/ksh/sh.h:1.20
--- src/bin/ksh/sh.h:1.19	Thu Jun 22 23:29:35 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:30:42 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.19 2017/06/22 23:29:35 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.20 2017/06/22 23:30:42 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.19 2017/06/22 23:29:35 kamil Exp $ */
+/* $Id: sh.h,v 1.20 2017/06/22 23:30:42 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -24,11 +24,6 @@
 #include 
 #include 
 
-#ifndef HAVE_MEMSET
-# define memcpy(d, s, n)	bcopy(s, d, n)
-# define memcmp(s1, s2, n)	bcmp(s1, s2, n)
-void *memset ARGS((void *d, int c, size_t n));
-#endif /* HAVE_MEMSET */
 #ifndef HAVE_MEMMOVE
 # ifdef HAVE_BCOPY
 #  define memmove(d, s, n)	bcopy(s, d, n)



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:29:35 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop usage of SVID header , it's legacy standard


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/config.h
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.24 src/bin/ksh/config.h:1.25
--- src/bin/ksh/config.h:1.24	Thu Jun 22 23:27:53 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:29:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.24 2017/06/22 23:27:53 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.25 2017/06/22 23:29:35 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -274,9 +274,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_LIMITS_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_MEMORY_H 1
-
 /* Define if you have the  header file.  */
 /* #undef HAVE_NDIR_H */
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.18 src/bin/ksh/sh.h:1.19
--- src/bin/ksh/sh.h:1.18	Thu Jun 22 23:27:53 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:29:35 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.18 2017/06/22 23:27:53 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.19 2017/06/22 23:29:35 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.18 2017/06/22 23:27:53 kamil Exp $ */
+/* $Id: sh.h,v 1.19 2017/06/22 23:29:35 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -24,9 +24,6 @@
 #include 
 #include 
 
-#ifdef HAVE_MEMORY_H
-# include 
-#endif
 #ifndef HAVE_MEMSET
 # define memcpy(d, s, n)	bcopy(s, d, n)
 # define memcmp(s1, s2, n)	bcmp(s1, s2, n)



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:27:53 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without strcasecmp(3) and strncasecmp(3)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/config.h
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.23 src/bin/ksh/config.h:1.24
--- src/bin/ksh/config.h:1.23	Thu Jun 22 23:26:17 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:27:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.23 2017/06/22 23:26:17 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.24 2017/06/22 23:27:53 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -244,9 +244,6 @@
 /* Define if you have the sigsetjmp function.  */
 #define HAVE_SIGSETJMP 1
 
-/* Define if you have the strcasecmp function.  */
-#define HAVE_STRCASECMP 1
-
 /* Define if you have the strerror function.  */
 #define HAVE_STRERROR 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.17 src/bin/ksh/sh.h:1.18
--- src/bin/ksh/sh.h:1.17	Thu Jun 22 23:26:17 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:27:53 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.17 2017/06/22 23:26:17 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.18 2017/06/22 23:27:53 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.17 2017/06/22 23:26:17 kamil Exp $ */
+/* $Id: sh.h,v 1.18 2017/06/22 23:27:53 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -24,11 +24,6 @@
 #include 
 #include 
 
-#ifndef HAVE_STRCASECMP
-int strcasecmp ARGS((const char *s1, const char *s2));
-int strncasecmp ARGS((const char *s1, const char *s2, int n));
-#endif /* HAVE_STRCASECMP */
-
 #ifdef HAVE_MEMORY_H
 # include 
 #endif



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:26:17 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without strstr(3)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/config.h
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.22 src/bin/ksh/config.h:1.23
--- src/bin/ksh/config.h:1.22	Thu Jun 22 23:23:27 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:26:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.22 2017/06/22 23:23:27 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.23 2017/06/22 23:26:17 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -250,9 +250,6 @@
 /* Define if you have the strerror function.  */
 #define HAVE_STRERROR 1
 
-/* Define if you have the strstr function.  */
-#define HAVE_STRSTR 1
-
 /* Define if you have the sysconf function.  */
 #define HAVE_SYSCONF 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.16 src/bin/ksh/sh.h:1.17
--- src/bin/ksh/sh.h:1.16	Thu Jun 22 23:23:27 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:26:17 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.16 2017/06/22 23:23:27 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.17 2017/06/22 23:26:17 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.16 2017/06/22 23:23:27 kamil Exp $ */
+/* $Id: sh.h,v 1.17 2017/06/22 23:26:17 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -24,9 +24,6 @@
 #include 
 #include 
 
-#ifndef HAVE_STRSTR
-char *strstr ARGS((const char *s, const char *p));
-#endif /* HAVE_STRSTR */
 #ifndef HAVE_STRCASECMP
 int strcasecmp ARGS((const char *s1, const char *s2));
 int strncasecmp ARGS((const char *s1, const char *s2, int n));



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:23:27 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without 


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/config.h
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.21 src/bin/ksh/config.h:1.22
--- src/bin/ksh/config.h:1.21	Thu Jun 22 23:19:53 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:23:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.21 2017/06/22 23:19:53 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.22 2017/06/22 23:23:27 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -289,9 +289,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_PATHS_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_STRING_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_SYS_DIR_H
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.15 src/bin/ksh/sh.h:1.16
--- src/bin/ksh/sh.h:1.15	Thu Jun 22 23:19:53 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:23:27 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.15 2017/06/22 23:19:53 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.16 2017/06/22 23:23:27 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.15 2017/06/22 23:19:53 kamil Exp $ */
+/* $Id: sh.h,v 1.16 2017/06/22 23:23:27 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -22,14 +22,8 @@
 #include 
 #include 
 #include 
+#include 
 
-#ifdef HAVE_STRING_H
-# include 
-#else
-# include 
-# define strchr index
-# define strrchr rindex
-#endif /* HAVE_STRING_H */
 #ifndef HAVE_STRSTR
 char *strstr ARGS((const char *s, const char *p));
 #endif /* HAVE_STRSTR */



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:19:53 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without 

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/config.h
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.20 src/bin/ksh/config.h:1.21
--- src/bin/ksh/config.h:1.20	Thu Jun 22 23:17:50 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:19:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.20 2017/06/22 23:17:50 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.21 2017/06/22 23:19:53 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -289,9 +289,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_PATHS_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_STDDEF_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_STRING_H 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.14 src/bin/ksh/sh.h:1.15
--- src/bin/ksh/sh.h:1.14	Thu Jun 22 23:17:50 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:19:53 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.14 2017/06/22 23:17:50 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.15 2017/06/22 23:19:53 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.14 2017/06/22 23:17:50 kamil Exp $ */
+/* $Id: sh.h,v 1.15 2017/06/22 23:19:53 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -19,10 +19,7 @@
 #include 
 #include 
 #include 
-#ifdef HAVE_STDDEF_H
-# include 
-#endif
-
+#include 
 #include 
 #include 
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:17:50 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without 

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/config.h
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.19 src/bin/ksh/config.h:1.20
--- src/bin/ksh/config.h:1.19	Thu Jun 22 23:15:05 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:17:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.19 2017/06/22 23:15:05 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.20 2017/06/22 23:17:50 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -292,9 +292,6 @@
 /* Define if you have the  header file.  */
 #define HAVE_STDDEF_H 1
 
-/* Define if you have the  header file.  */
-#define HAVE_STDLIB_H 1
-
 /* Define if you have the  header file.  */
 #define HAVE_STRING_H 1
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.13 src/bin/ksh/sh.h:1.14
--- src/bin/ksh/sh.h:1.13	Thu Jun 22 23:15:05 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:17:50 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.13 2017/06/22 23:15:05 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.14 2017/06/22 23:17:50 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.13 2017/06/22 23:15:05 kamil Exp $ */
+/* $Id: sh.h,v 1.14 2017/06/22 23:17:50 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -23,20 +23,7 @@
 # include 
 #endif
 
-#ifdef HAVE_STDLIB_H
-# include 
-#else
-/* just a useful subset of what stdlib.h would have */
-extern char * getenv  ARGS((const char *));
-extern void * malloc  ARGS((size_t));
-extern void * realloc ARGS((void *, size_t));
-extern intfreeARGS((void *));
-extern intexitARGS((int));
-extern intrandARGS((void));
-extern void   srand   ARGS((unsigned int));
-extern intatoiARGS((const char *));
-#endif /* HAVE_STDLIB_H */
-
+#include 
 #include 
 
 #ifdef HAVE_STRING_H



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:15:05 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h

Log Message:
ksh: Drop support for systems without 

This code wouldn't work for them anyway.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/config.h
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.18 src/bin/ksh/config.h:1.19
--- src/bin/ksh/config.h:1.18	Thu Jun 22 23:11:48 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:15:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.18 2017/06/22 23:11:48 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.19 2017/06/22 23:15:05 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -23,9 +23,6 @@
 /* Define if you have  that is POSIX.1 compatible.  */
 #define HAVE_SYS_WAIT_H 1
 
-/* Define if you have .  */
-#define HAVE_UNISTD_H 1
-
 /* Define if on MINIX.  */
 /* #undef _MINIX */
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.12 src/bin/ksh/sh.h:1.13
--- src/bin/ksh/sh.h:1.12	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 23:15:05 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.12 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.13 2017/06/22 23:15:05 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.12 2017/06/22 14:20:46 kamil Exp $ */
+/* $Id: sh.h,v 1.13 2017/06/22 23:15:05 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -37,45 +37,7 @@ extern void   srand   ARGS((unsigned int
 extern intatoiARGS((const char *));
 #endif /* HAVE_STDLIB_H */
 
-#ifdef HAVE_UNISTD_H
-# include 
-#else
-/* just a useful subset of what unistd.h would have */
-extern int access ARGS((const char *, int));
-extern int open ARGS((const char *, int, ...));
-extern int creat ARGS((const char *, mode_t));
-extern int read ARGS((int, char *, unsigned));
-extern int write ARGS((int, const char *, unsigned));
-extern off_t lseek ARGS((int, off_t, int));
-extern int close ARGS((int));
-extern int pipe ARGS((int []));
-extern int dup2 ARGS((int, int));
-extern int unlink ARGS((const char *));
-extern int fork ARGS((void));
-extern int execve ARGS((const char *, char * const[], char * const[]));
-extern int chdir ARGS((const char *));
-extern int kill ARGS((pid_t, int));
-extern char *getcwd();	/* no ARGS here - differs on different machines */
-extern int geteuid ARGS((void));
-extern int readlink ARGS((const char *, char *, int));
-extern int getegid ARGS((void));
-extern int getpid ARGS((void));
-extern int getppid ARGS((void));
-extern unsigned int sleep ARGS((unsigned int));
-extern int isatty ARGS((int));
-# ifdef POSIX_PGRP
-extern int getpgrp ARGS((void));
-extern int setpgid ARGS((pid_t, pid_t));
-# endif /* POSIX_PGRP */
-# ifdef BSD_PGRP
-extern int getpgrp ARGS((pid_t));
-extern int setpgrp ARGS((pid_t, pid_t));
-# endif /* BSD_PGRP */
-# ifdef SYSV_PGRP
-extern int getpgrp ARGS((void));
-extern int setpgrp ARGS((void));
-# endif /* SYSV_PGRP */
-#endif /* HAVE_UNISTD_H */
+#include 
 
 #ifdef HAVE_STRING_H
 # include 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:11:48 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Kill switch for CLOSEDIR_VOID (closedir(2) returns void)

No users in the code. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.17 src/bin/ksh/config.h:1.18
--- src/bin/ksh/config.h:1.17	Thu Jun 22 23:09:32 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:11:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.17 2017/06/22 23:09:32 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.18 2017/06/22 23:11:48 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -11,9 +11,6 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
-/* Define if the closedir function returns void instead of int.  */
-/* #undef CLOSEDIR_VOID */
-
 /* Define to `int' if  doesn't define.  */
 /* #undef gid_t */
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 23:09:32 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
ksh: Assume that $CC handles const (ANSI C89)

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.16 src/bin/ksh/config.h:1.17
--- src/bin/ksh/config.h:1.16	Thu Jun 22 19:46:54 2017
+++ src/bin/ksh/config.h	Thu Jun 22 23:09:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.16 2017/06/22 19:46:54 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.17 2017/06/22 23:09:32 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -14,9 +14,6 @@
 /* Define if the closedir function returns void instead of int.  */
 /* #undef CLOSEDIR_VOID */
 
-/* Define to empty if the keyword does not work.  */
-/* #undef const */
-
 /* Define to `int' if  doesn't define.  */
 /* #undef gid_t */
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 19:46:54 UTC 2017

Modified Files:
src/bin/ksh: config.h

Log Message:
Drop support for $CC incapable to use void* / volatile* (pre ANSI C89)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.15 src/bin/ksh/config.h:1.16
--- src/bin/ksh/config.h:1.15	Thu Jun 22 19:41:07 2017
+++ src/bin/ksh/config.h	Thu Jun 22 19:46:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.15 2017/06/22 19:41:07 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.16 2017/06/22 19:46:54 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -105,12 +105,6 @@
 /* Define if you don't have setpgrp(), setpgid() or getpgrp() routines */
 /* #undef NO_PGRP */
 
-/* Define to char if your compiler doesn't like the void keyword */
-/* #undef void */
-
-/* Define to nothing if compiler doesn't like the volatile keyword */
-/* #undef volatile */
-
 /* Define if C compiler groks function prototypes */
 #define HAVE_PROTOTYPES 1
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 19:41:07 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c config.h io.c

Log Message:
Drop Ultrix support from ksh(1), a DEC UNIX for VAX


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/config.h
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.23 src/bin/ksh/c_ksh.c:1.24
--- src/bin/ksh/c_ksh.c:1.23	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/c_ksh.c	Thu Jun 22 19:41:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.23 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.23 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $");
 #endif
 
 #include "sh.h"
@@ -325,7 +325,7 @@ c_print(wp)
 
 switch ((c = *s++)) {
 /* Oddly enough, \007 seems more portable than
- * \a (due to Ultrix cc, old pcc's,
+ * \a (due to old pcc's,
  * etc.).
  */
 case 'a': c = '\007'; break;

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.14 src/bin/ksh/config.h:1.15
--- src/bin/ksh/config.h:1.14	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/config.h	Thu Jun 22 19:41:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.14 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.15 2017/06/22 19:41:07 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -72,9 +72,6 @@
 /* Define if your kernel doesn't handle scripts starting with #! */
 /* #undef SHARPBANG */
 
-/* Define if dup2() preserves the close-on-exec flag (ultrix does this) */
-/* #undef DUP2_BROKEN */
-
 /* Define as the return value of signal handlers (0 or ).  */
 #define RETSIGVAL 
 

Index: src/bin/ksh/io.c
diff -u src/bin/ksh/io.c:1.12 src/bin/ksh/io.c:1.13
--- src/bin/ksh/io.c:1.12	Thu Jun 22 14:20:46 2017
+++ src/bin/ksh/io.c	Thu Jun 22 19:41:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.12 2017/06/22 14:20:46 kamil Exp $	*/
+/*	$NetBSD: io.c,v 1.13 2017/06/22 19:41:07 kamil Exp $	*/
 
 /*
  * shell buffered IO and formatted output
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: io.c,v 1.12 2017/06/22 14:20:46 kamil Exp $");
+__RCSID("$NetBSD: io.c,v 1.13 2017/06/22 19:41:07 kamil Exp $");
 #endif
 
 
@@ -283,12 +283,6 @@ ksh_dup2(ofd, nfd, errok)
 	if (ret < 0 && errno != EBADF && !errok)
 		errorf("too many files open in shell");
 
-#ifdef DUP2_BROKEN
-	/* Ultrix systems like to preserve the close-on-exec flag */
-	if (ret >= 0)
-		(void) fcntl(nfd, F_SETFD, 0);
-#endif /* DUP2_BROKEN */
-
 	return ret;
 }
 



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 14:20:46 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c c_ulimit.c config.h edit.c emacs.c eval.c
exec.c history.c io.c jobs.c lex.c main.c misc.c path.c sh.h shf.c
trap.c tree.h vi.c

Log Message:
Reapply removal of code from 90ties for OS/2 Cygwin AIX HPUX SCOUnix

Added missing #endif terminator in emacs.c


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/c_sh.c src/bin/ksh/eval.c
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/c_ulimit.c src/bin/ksh/history.c
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/config.h
cvs rdiff -u -r1.29 -r1.30 src/bin/ksh/edit.c
cvs rdiff -u -r1.34 -r1.35 src/bin/ksh/emacs.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/exec.c src/bin/ksh/lex.c \
src/bin/ksh/main.c
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/io.c src/bin/ksh/path.c \
src/bin/ksh/sh.h
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/jobs.c
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/misc.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/shf.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/trap.c
cvs rdiff -u -r1.6 -r1.7 src/bin/ksh/tree.h
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.22 src/bin/ksh/c_ksh.c:1.23
--- src/bin/ksh/c_ksh.c:1.22	Thu Jun 22 14:11:27 2017
+++ src/bin/ksh/c_ksh.c	Thu Jun 22 14:20:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.22 2017/06/22 14:11:27 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.23 2017/06/22 14:20:46 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,17 +6,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.22 2017/06/22 14:11:27 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.23 2017/06/22 14:20:46 kamil Exp $");
 #endif
 
 #include "sh.h"
 #include "ksh_stat.h"
 #include 
 
-#ifdef __CYGWIN__
-#include 
-#endif /* __CYGWIN__ */
-
 int
 c_cd(wp)
 	char	**wp;
@@ -145,15 +141,7 @@ c_cd(wp)
 		setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR);
 
 	if (!ISABSPATH(Xstring(xs, xp))) {
-#ifdef OS2
-		/* simplify_path() doesn't know about os/2's drive contexts,
-		 * so it can't set current_wd when changing to a:foo.
-		 * Handle this by calling getcwd()...
-		 */
-		pwd = ksh_get_wd((char *) 0, 0);
-#else /* OS2 */
 		pwd = (char *) 0;
-#endif /* OS2 */
 	} else
 #ifdef S_ISLNK
 	if (!physical || !(pwd = get_phys_path(Xstring(xs, xp
@@ -162,12 +150,7 @@ c_cd(wp)
 
 	/* Set PWD */
 	if (pwd) {
-#ifdef __CYGWIN__
-		char ptmp[PATH];  /* larger than MAX_PATH */
-		cygwin_conv_to_full_posix_path(pwd, ptmp);
-#else /* __CYGWIN__ */
 		char *ptmp = pwd;
-#endif /* __CYGWIN__ */
 		set_current_wd(ptmp);
 		/* Ignore failure (happens if readonly or integer) */
 		setstr(pwd_s, ptmp, KSH_RETURN_ERROR);
@@ -241,7 +224,6 @@ c_print(wp)
 #define PO_PMINUSMINUS	BIT(2)	/* print a -- argument */
 #define PO_HIST		BIT(3)	/* print to history instead of stdout */
 #define PO_COPROC	BIT(4)	/* printing to coprocess: block SIGPIPE */
-#define PO_FSLASH	BIT(5)  /* swap slash for backslash (for os2 ) */
 	int fd = 1;
 	int flags = PO_EXPAND|PO_NL;
 	char *s;
@@ -282,11 +264,7 @@ c_print(wp)
 		}
 	} else {
 		int optc;
-#if OS2
-		const char *options = "Rnpfrsu,"; /* added f flag */
-#else
 		const char *options = "Rnprsu,";
-#endif
 		while ((optc = ksh_getopt(wp, _opt, options)) != EOF)
 			switch (optc) {
 			  case 'R': /* fake BSD echo command */
@@ -297,11 +275,6 @@ c_print(wp)
 			  case 'e':
 flags |= PO_EXPAND;
 break;
-#ifdef OS2
-			  case 'f':
-flags |= PO_FSLASH;
-break;
-#endif
 			  case 'n':
 flags &= ~PO_NL;
 break;
@@ -347,19 +320,12 @@ c_print(wp)
 		s = *wp;
 		while ((c = *s++) != '\0') {
 			Xcheck(xs, xp);
-#ifdef OS2
-			if ((flags & PO_FSLASH) && c == '\\')
-if (*s == '\\')
-	*s++;
-else
-	c = '/';
-#endif /* OS2 */
 			if ((flags & PO_EXPAND) && c == '\\') {
 int i;
 
 switch ((c = *s++)) {
 /* Oddly enough, \007 seems more portable than
- * \a (due to HP-UX cc, Ultrix cc, old pcc's,
+ * \a (due to Ultrix cc, old pcc's,
  * etc.).
  */
 case 'a': c = '\007'; break;

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.18 src/bin/ksh/c_sh.c:1.19
--- src/bin/ksh/c_sh.c:1.18	Thu Jun 22 14:11:27 2017
+++ src/bin/ksh/c_sh.c	Thu Jun 22 14:20:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.18 2017/06/22 14:11:27 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.18 2017/06/22 14:11:27 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.19 2017/06/22 14:20:46 kamil Exp $");
 #endif
 
 
@@ -331,9 +331,6 @@ c_read(wp)
 			while (1) {
 c = shf_getc(shf);
 if (c == '\0'
-#ifdef OS2
-|| c == '\r'
-#endif /* OS2 */
 )
 	continue;
 

CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 14:11:28 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c c_ulimit.c config.h edit.c emacs.c eval.c
exec.c history.c io.c jobs.c lex.c main.c misc.c path.c sh.h shf.c
trap.c tree.h vi.c

Log Message:
Temporarily revert previous.

emacs.* gets wrong code in generation


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/c_sh.c src/bin/ksh/eval.c
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/c_ulimit.c src/bin/ksh/history.c
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/config.h
cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/edit.c
cvs rdiff -u -r1.33 -r1.34 src/bin/ksh/emacs.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/exec.c src/bin/ksh/lex.c \
src/bin/ksh/main.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/io.c src/bin/ksh/path.c \
src/bin/ksh/sh.h
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/jobs.c
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/misc.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/shf.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/trap.c
cvs rdiff -u -r1.5 -r1.6 src/bin/ksh/tree.h
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.21 src/bin/ksh/c_ksh.c:1.22
--- src/bin/ksh/c_ksh.c:1.21	Thu Jun 22 13:35:47 2017
+++ src/bin/ksh/c_ksh.c	Thu Jun 22 14:11:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.21 2017/06/22 13:35:47 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.22 2017/06/22 14:11:27 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,13 +6,17 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.21 2017/06/22 13:35:47 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.22 2017/06/22 14:11:27 kamil Exp $");
 #endif
 
 #include "sh.h"
 #include "ksh_stat.h"
 #include 
 
+#ifdef __CYGWIN__
+#include 
+#endif /* __CYGWIN__ */
+
 int
 c_cd(wp)
 	char	**wp;
@@ -141,7 +145,15 @@ c_cd(wp)
 		setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR);
 
 	if (!ISABSPATH(Xstring(xs, xp))) {
+#ifdef OS2
+		/* simplify_path() doesn't know about os/2's drive contexts,
+		 * so it can't set current_wd when changing to a:foo.
+		 * Handle this by calling getcwd()...
+		 */
+		pwd = ksh_get_wd((char *) 0, 0);
+#else /* OS2 */
 		pwd = (char *) 0;
+#endif /* OS2 */
 	} else
 #ifdef S_ISLNK
 	if (!physical || !(pwd = get_phys_path(Xstring(xs, xp
@@ -150,7 +162,12 @@ c_cd(wp)
 
 	/* Set PWD */
 	if (pwd) {
+#ifdef __CYGWIN__
+		char ptmp[PATH];  /* larger than MAX_PATH */
+		cygwin_conv_to_full_posix_path(pwd, ptmp);
+#else /* __CYGWIN__ */
 		char *ptmp = pwd;
+#endif /* __CYGWIN__ */
 		set_current_wd(ptmp);
 		/* Ignore failure (happens if readonly or integer) */
 		setstr(pwd_s, ptmp, KSH_RETURN_ERROR);
@@ -224,6 +241,7 @@ c_print(wp)
 #define PO_PMINUSMINUS	BIT(2)	/* print a -- argument */
 #define PO_HIST		BIT(3)	/* print to history instead of stdout */
 #define PO_COPROC	BIT(4)	/* printing to coprocess: block SIGPIPE */
+#define PO_FSLASH	BIT(5)  /* swap slash for backslash (for os2 ) */
 	int fd = 1;
 	int flags = PO_EXPAND|PO_NL;
 	char *s;
@@ -264,7 +282,11 @@ c_print(wp)
 		}
 	} else {
 		int optc;
+#if OS2
+		const char *options = "Rnpfrsu,"; /* added f flag */
+#else
 		const char *options = "Rnprsu,";
+#endif
 		while ((optc = ksh_getopt(wp, _opt, options)) != EOF)
 			switch (optc) {
 			  case 'R': /* fake BSD echo command */
@@ -275,6 +297,11 @@ c_print(wp)
 			  case 'e':
 flags |= PO_EXPAND;
 break;
+#ifdef OS2
+			  case 'f':
+flags |= PO_FSLASH;
+break;
+#endif
 			  case 'n':
 flags &= ~PO_NL;
 break;
@@ -320,12 +347,19 @@ c_print(wp)
 		s = *wp;
 		while ((c = *s++) != '\0') {
 			Xcheck(xs, xp);
+#ifdef OS2
+			if ((flags & PO_FSLASH) && c == '\\')
+if (*s == '\\')
+	*s++;
+else
+	c = '/';
+#endif /* OS2 */
 			if ((flags & PO_EXPAND) && c == '\\') {
 int i;
 
 switch ((c = *s++)) {
 /* Oddly enough, \007 seems more portable than
- * \a (due to Ultrix cc, old pcc's,
+ * \a (due to HP-UX cc, Ultrix cc, old pcc's,
  * etc.).
  */
 case 'a': c = '\007'; break;

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.17 src/bin/ksh/c_sh.c:1.18
--- src/bin/ksh/c_sh.c:1.17	Thu Jun 22 13:33:39 2017
+++ src/bin/ksh/c_sh.c	Thu Jun 22 14:11:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.17 2017/06/22 13:33:39 kamil Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.18 2017/06/22 14:11:27 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.17 2017/06/22 13:33:39 kamil Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.18 2017/06/22 14:11:27 kamil Exp $");
 #endif
 
 
@@ -331,6 +331,9 @@ c_read(wp)
 			while (1) {
 c = shf_getc(shf);
 if (c == '\0'
+#ifdef OS2
+|| c == '\r'
+#endif /* OS2 */
 )
 	continue;
 if (c == EOF && shf_error(shf)
@@ -902,5 +905,13 

CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 13:37:16 UTC 2017

Modified Files:
src/bin/ksh: config.h sh.h trap.c

Log Message:
Remove code for AIX, including hack for 3.2.5 (from 1997) - from ksh(1)

OK by 


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/config.h
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/sh.h
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.11 src/bin/ksh/config.h:1.12
--- src/bin/ksh/config.h:1.11	Thu Jun 22 13:35:47 2017
+++ src/bin/ksh/config.h	Thu Jun 22 13:37:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.11 2017/06/22 13:35:47 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.12 2017/06/22 13:37:16 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -11,13 +11,6 @@
 #ifndef CONFIG_H
 #define CONFIG_H
 
-/* Define if on AIX 3.
-   System headers sometimes define this.
-   We just want to avoid a redefinition error message.  */
-#ifndef _ALL_SOURCE
-/* #undef _ALL_SOURCE */
-#endif
-
 /* Define if the closedir function returns void instead of int.  */
 /* #undef CLOSEDIR_VOID */
 

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.9 src/bin/ksh/sh.h:1.10
--- src/bin/ksh/sh.h:1.9	Thu Jun 22 13:33:39 2017
+++ src/bin/ksh/sh.h	Thu Jun 22 13:37:16 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.9 2017/06/22 13:33:39 kamil Exp $	*/
+/*	$NetBSD: sh.h,v 1.10 2017/06/22 13:37:16 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.9 2017/06/22 13:33:39 kamil Exp $ */
+/* $Id: sh.h,v 1.10 2017/06/22 13:37:16 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -545,10 +545,7 @@ typedef struct trap {
 EXTERN	int volatile trap;	/* traps pending? */
 EXTERN	int volatile intrsig;	/* pending trap interrupts executing command */
 EXTERN	int volatile fatal_trap;/* received a fatal signal */
-#ifndef FROM_TRAP_C
-/* Kludge to avoid bogus re-declaration of sigtraps[] error on AIX 3.2.5 */
 extern	Trap	sigtraps[SIGNALS+1];
-#endif /* !FROM_TRAP_C */
 
 #ifdef KSH
 /*

Index: src/bin/ksh/trap.c
diff -u src/bin/ksh/trap.c:1.8 src/bin/ksh/trap.c:1.9
--- src/bin/ksh/trap.c:1.8	Mon Oct 16 00:07:32 2006
+++ src/bin/ksh/trap.c	Thu Jun 22 13:37:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.8 2006/10/16 00:07:32 christos Exp $	*/
+/*	$NetBSD: trap.c,v 1.9 2017/06/22 13:37:16 kamil Exp $	*/
 
 /*
  * signal handling
@@ -6,12 +6,9 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: trap.c,v 1.8 2006/10/16 00:07:32 christos Exp $");
+__RCSID("$NetBSD: trap.c,v 1.9 2017/06/22 13:37:16 kamil Exp $");
 #endif
 
-
-/* Kludge to avoid bogus re-declaration of sigtraps[] error on AIX 3.2.5 */
-#define FROM_TRAP_C
 #include "sh.h"
 
 /* Table is indexed by signal number



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 13:35:47 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_ulimit.c config.h misc.c

Log Message:
Drop HP-UX support from ksh(1)

OK by 


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/c_ulimit.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/config.h
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.20 src/bin/ksh/c_ksh.c:1.21
--- src/bin/ksh/c_ksh.c:1.20	Thu Jun 22 13:33:39 2017
+++ src/bin/ksh/c_ksh.c	Thu Jun 22 13:35:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.20 2017/06/22 13:33:39 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.21 2017/06/22 13:35:47 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.20 2017/06/22 13:33:39 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.21 2017/06/22 13:35:47 kamil Exp $");
 #endif
 
 #include "sh.h"
@@ -325,7 +325,7 @@ c_print(wp)
 
 switch ((c = *s++)) {
 /* Oddly enough, \007 seems more portable than
- * \a (due to HP-UX cc, Ultrix cc, old pcc's,
+ * \a (due to Ultrix cc, old pcc's,
  * etc.).
  */
 case 'a': c = '\007'; break;

Index: src/bin/ksh/c_ulimit.c
diff -u src/bin/ksh/c_ulimit.c:1.12 src/bin/ksh/c_ulimit.c:1.13
--- src/bin/ksh/c_ulimit.c:1.12	Sat May  9 13:26:06 2015
+++ src/bin/ksh/c_ulimit.c	Thu Jun 22 13:35:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ulimit.c,v 1.12 2015/05/09 13:26:06 christos Exp $	*/
+/*	$NetBSD: c_ulimit.c,v 1.13 2017/06/22 13:35:47 kamil Exp $	*/
 
 /*
 	ulimit -- handle "ulimit" builtin
@@ -20,7 +20,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ulimit.c,v 1.12 2015/05/09 13:26:06 christos Exp $");
+__RCSID("$NetBSD: c_ulimit.c,v 1.13 2017/06/22 13:35:47 kamil Exp $");
 #endif
 
 
@@ -113,9 +113,6 @@ c_ulimit(wp)
 #  ifdef UL_GETBREAK /* osf/1 */
 		{ "vmemory(maxaddr)", ULIMIT, UL_GETBREAK, -1, 1, 'v' },
 #  else /* UL_GETBREAK */
-#   ifdef UL_GETMAXBRK /* hpux */
-		{ "vmemory(maxaddr)", ULIMIT, UL_GETMAXBRK, -1, 1, 'v' },
-#   endif /* UL_GETMAXBRK */
 #  endif /* UL_GETBREAK */
 # endif /* UL_GMEMLIM */
 #endif /* RLIMIT_VMEM */

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.10 src/bin/ksh/config.h:1.11
--- src/bin/ksh/config.h:1.10	Thu Jun 22 13:34:48 2017
+++ src/bin/ksh/config.h	Thu Jun 22 13:35:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.10 2017/06/22 13:34:48 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.11 2017/06/22 13:35:47 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -194,10 +194,6 @@
 #define DEFAULT_PATH "/bin:/usr/bin:/sbin:/usr/sbin"
 #endif
 
-/* Define if your C library's getwd/getcwd function dumps core in unreadable
- * directories.  */
-/* #undef HPUX_GETWD_BUG */
-
 /* Include ksh features? */
 #define KSH 1
 

Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.18 src/bin/ksh/misc.c:1.19
--- src/bin/ksh/misc.c:1.18	Thu Jun 22 13:33:39 2017
+++ src/bin/ksh/misc.c	Thu Jun 22 13:35:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.18 2017/06/22 13:33:39 kamil Exp $	*/
+/*	$NetBSD: misc.c,v 1.19 2017/06/22 13:35:47 kamil Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: misc.c,v 1.18 2017/06/22 13:33:39 kamil Exp $");
+__RCSID("$NetBSD: misc.c,v 1.19 2017/06/22 13:35:47 kamil Exp $");
 #endif
 
 
@@ -1284,25 +1284,6 @@ reset_nonblock(fd)
 # define MAXPATHLEN PATH
 #endif /* MAXPATHLEN */
 
-#ifdef HPUX_GETWD_BUG
-# include "ksh_dir.h"
-
-/*
- * Work around bug in hpux 10.x C library - getwd/getcwd dump core
- * if current directory is not readable.  Done in macro 'cause code
- * is needed in GETWD and GETCWD cases.
- */
-# define HPUX_GETWD_BUG_CODE \
-	{ \
-	DIR *d = ksh_opendir("."); \
-	if (!d) \
-		return (char *) 0; \
-	closedir(d); \
-	}
-#else /* HPUX_GETWD_BUG */
-# define HPUX_GETWD_BUG_CODE
-#endif /* HPUX_GETWD_BUG */
-
 /* Like getcwd(), except bsize is ignored if buf is 0 (MAXPATHLEN is used) */
 char *
 ksh_get_wd(buf, bsize)
@@ -1313,9 +1294,6 @@ ksh_get_wd(buf, bsize)
 	char *b;
 	char *ret;
 
-	/* Before memory allocated */
-	HPUX_GETWD_BUG_CODE
-
 	/* Assume getcwd() available */
 	if (!buf) {
 		bsize = MAXPATHLEN;
@@ -1338,9 +1316,6 @@ ksh_get_wd(buf, bsize)
 	char *b;
 	int len;
 
-	/* Before memory allocated */
-	HPUX_GETWD_BUG_CODE
-
 	if (buf && bsize > MAXPATHLEN)
 		b = buf;
 	else



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 13:34:48 UTC 2017

Modified Files:
src/bin/ksh: config.h edit.c

Log Message:
Remove sco unix 3.2v4.1 support (from 1992) from ksh(1)

OK by 


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/config.h
cvs rdiff -u -r1.27 -r1.28 src/bin/ksh/edit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/config.h
diff -u src/bin/ksh/config.h:1.9 src/bin/ksh/config.h:1.10
--- src/bin/ksh/config.h:1.9	Thu Jun 22 13:33:39 2017
+++ src/bin/ksh/config.h	Thu Jun 22 13:34:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: config.h,v 1.9 2017/06/22 13:33:39 kamil Exp $	*/
+/*	$NetBSD: config.h,v 1.10 2017/06/22 13:34:48 kamil Exp $	*/
 
 /* config.h.  Generated automatically by configure.  */
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */
@@ -178,9 +178,6 @@
 /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */
 /* #undef NEED_PGRP_SYNC */
 
-/* Define if you arg running SCO unix */
-/* #undef OS_SCO */
-
 /* Define if you arg running ISC unix */
 /* #undef OS_ISC */
 

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.27 src/bin/ksh/edit.c:1.28
--- src/bin/ksh/edit.c:1.27	Thu Jun 22 13:33:39 2017
+++ src/bin/ksh/edit.c	Thu Jun 22 13:34:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.27 2017/06/22 13:33:39 kamil Exp $	*/
+/*	$NetBSD: edit.c,v 1.28 2017/06/22 13:34:48 kamil Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.27 2017/06/22 13:33:39 kamil Exp $");
+__RCSID("$NetBSD: edit.c,v 1.28 2017/06/22 13:34:48 kamil Exp $");
 #endif
 
 
@@ -19,10 +19,6 @@ __RCSID("$NetBSD: edit.c,v 1.27 2017/06/
 #define EXTERN
 #include "edit.h"
 #undef EXTERN
-#ifdef OS_SCO	/* SCO Unix 3.2v4.1 */
-# include 	/* needed for  */
-# include 		/* needed for struct winsize */
-#endif /* OS_SCO */
 #include 
 #include 
 #include "ksh_stat.h"



CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 13:33:39 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c c_sh.c config.h edit.c emacs.c eval.c exec.c
history.c io.c jobs.c lex.c main.c misc.c path.c sh.h shf.c tree.h
vi.c

Log Message:
Remove os2 support in ksh(1)

OK by 


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/c_sh.c src/bin/ksh/eval.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/config.h src/bin/ksh/sh.h
cvs rdiff -u -r1.26 -r1.27 src/bin/ksh/edit.c
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/emacs.c
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/exec.c src/bin/ksh/lex.c \
src/bin/ksh/main.c
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/history.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/io.c src/bin/ksh/path.c
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/jobs.c
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/misc.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/shf.c
cvs rdiff -u -r1.4 -r1.5 src/bin/ksh/tree.h
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.19 src/bin/ksh/c_ksh.c:1.20
--- src/bin/ksh/c_ksh.c:1.19	Thu Jun 22 13:32:04 2017
+++ src/bin/ksh/c_ksh.c	Thu Jun 22 13:33:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.19 2017/06/22 13:32:04 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.20 2017/06/22 13:33:39 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.19 2017/06/22 13:32:04 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.20 2017/06/22 13:33:39 kamil Exp $");
 #endif
 
 #include "sh.h"
@@ -141,15 +141,7 @@ c_cd(wp)
 		setstr(oldpwd_s, current_wd, KSH_RETURN_ERROR);
 
 	if (!ISABSPATH(Xstring(xs, xp))) {
-#ifdef OS2
-		/* simplify_path() doesn't know about os/2's drive contexts,
-		 * so it can't set current_wd when changing to a:foo.
-		 * Handle this by calling getcwd()...
-		 */
-		pwd = ksh_get_wd((char *) 0, 0);
-#else /* OS2 */
 		pwd = (char *) 0;
-#endif /* OS2 */
 	} else
 #ifdef S_ISLNK
 	if (!physical || !(pwd = get_phys_path(Xstring(xs, xp
@@ -232,7 +224,6 @@ c_print(wp)
 #define PO_PMINUSMINUS	BIT(2)	/* print a -- argument */
 #define PO_HIST		BIT(3)	/* print to history instead of stdout */
 #define PO_COPROC	BIT(4)	/* printing to coprocess: block SIGPIPE */
-#define PO_FSLASH	BIT(5)  /* swap slash for backslash (for os2 ) */
 	int fd = 1;
 	int flags = PO_EXPAND|PO_NL;
 	char *s;
@@ -273,11 +264,7 @@ c_print(wp)
 		}
 	} else {
 		int optc;
-#if OS2
-		const char *options = "Rnpfrsu,"; /* added f flag */
-#else
 		const char *options = "Rnprsu,";
-#endif
 		while ((optc = ksh_getopt(wp, _opt, options)) != EOF)
 			switch (optc) {
 			  case 'R': /* fake BSD echo command */
@@ -288,11 +275,6 @@ c_print(wp)
 			  case 'e':
 flags |= PO_EXPAND;
 break;
-#ifdef OS2
-			  case 'f':
-flags |= PO_FSLASH;
-break;
-#endif
 			  case 'n':
 flags &= ~PO_NL;
 break;
@@ -338,13 +320,6 @@ c_print(wp)
 		s = *wp;
 		while ((c = *s++) != '\0') {
 			Xcheck(xs, xp);
-#ifdef OS2
-			if ((flags & PO_FSLASH) && c == '\\')
-if (*s == '\\')
-	*s++;
-else
-	c = '/';
-#endif /* OS2 */
 			if ((flags & PO_EXPAND) && c == '\\') {
 int i;
 

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.16 src/bin/ksh/c_sh.c:1.17
--- src/bin/ksh/c_sh.c:1.16	Tue Oct 11 06:31:07 2016
+++ src/bin/ksh/c_sh.c	Thu Jun 22 13:33:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.16 2016/10/11 06:31:07 dholland Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.17 2017/06/22 13:33:39 kamil Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.16 2016/10/11 06:31:07 dholland Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.17 2017/06/22 13:33:39 kamil Exp $");
 #endif
 
 
@@ -331,9 +331,6 @@ c_read(wp)
 			while (1) {
 c = shf_getc(shf);
 if (c == '\0'
-#ifdef OS2
-|| c == '\r'
-#endif /* OS2 */
 )
 	continue;
 if (c == EOF && shf_error(shf)
@@ -905,13 +902,5 @@ const struct builtin shbuiltins [] = {
 	{"ulimit", c_ulimit},
 	{"+umask", c_umask},
 	{"*=unset", c_unset},
-#ifdef OS2
-	/* In OS2, the first line of a file can be "extproc name", which
-	 * tells the command interpreter (cmd.exe) to use name to execute
-	 * the file.  For this to be useful, ksh must ignore commands
-	 * starting with extproc and this does the trick...
-	 */
-	{"extproc", c_label},
-#endif /* OS2 */
 	{NULL, NULL}
 };
Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.16 src/bin/ksh/eval.c:1.17
--- src/bin/ksh/eval.c:1.16	Tue Oct  4 15:09:03 2016
+++ src/bin/ksh/eval.c	Thu Jun 22 13:33:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.16 2016/10/04 15:09:03 joerg Exp $	*/
+/*	$NetBSD: eval.c,v 1.17 2017/06/22 13:33:39 kamil Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ 

CVS commit: src/bin/ksh

2017-06-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 22 13:32:04 UTC 2017

Modified Files:
src/bin/ksh: c_ksh.c edit.c path.c sh.h

Log Message:
Remove ancient cygwin support in ksh(1)

OK by 


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.25 -r1.26 src/bin/ksh/edit.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/path.c
cvs rdiff -u -r1.7 -r1.8 src/bin/ksh/sh.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.18 src/bin/ksh/c_ksh.c:1.19
--- src/bin/ksh/c_ksh.c:1.18	Sun Oct 16 17:12:11 2011
+++ src/bin/ksh/c_ksh.c	Thu Jun 22 13:32:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.18 2011/10/16 17:12:11 joerg Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.19 2017/06/22 13:32:04 kamil Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,17 +6,13 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.18 2011/10/16 17:12:11 joerg Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.19 2017/06/22 13:32:04 kamil Exp $");
 #endif
 
 #include "sh.h"
 #include "ksh_stat.h"
 #include 
 
-#ifdef __CYGWIN__
-#include 
-#endif /* __CYGWIN__ */
-
 int
 c_cd(wp)
 	char	**wp;
@@ -162,12 +158,7 @@ c_cd(wp)
 
 	/* Set PWD */
 	if (pwd) {
-#ifdef __CYGWIN__
-		char ptmp[PATH];  /* larger than MAX_PATH */
-		cygwin_conv_to_full_posix_path(pwd, ptmp);
-#else /* __CYGWIN__ */
 		char *ptmp = pwd;
-#endif /* __CYGWIN__ */
 		set_current_wd(ptmp);
 		/* Ignore failure (happens if readonly or integer) */
 		setstr(pwd_s, ptmp, KSH_RETURN_ERROR);

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.25 src/bin/ksh/edit.c:1.26
--- src/bin/ksh/edit.c:1.25	Sat Jun  5 03:02:37 2010
+++ src/bin/ksh/edit.c	Thu Jun 22 13:32:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.25 2010/06/05 03:02:37 sjg Exp $	*/
+/*	$NetBSD: edit.c,v 1.26 2017/06/22 13:32:04 kamil Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: edit.c,v 1.25 2010/06/05 03:02:37 sjg Exp $");
+__RCSID("$NetBSD: edit.c,v 1.26 2017/06/22 13:32:04 kamil Exp $");
 #endif
 
 
@@ -293,11 +293,6 @@ x_mode(onoff)
 
 		set_tty(tty_fd, , TF_WAIT);
 
-#ifdef __CYGWIN__
-		if (edchars.eof == '\0')
-			edchars.eof = '\4';
-#endif /* __CYGWIN__ */
-
 		/* Convert unset values to internal `unset' value */
 		if (edchars.erase == vdisable_c)
 			edchars.erase = -1;

Index: src/bin/ksh/path.c
diff -u src/bin/ksh/path.c:1.8 src/bin/ksh/path.c:1.9
--- src/bin/ksh/path.c:1.8	Sat Apr 25 05:11:37 2009
+++ src/bin/ksh/path.c	Thu Jun 22 13:32:04 2017
@@ -1,8 +1,8 @@
-/*	$NetBSD: path.c,v 1.8 2009/04/25 05:11:37 lukem Exp $	*/
+/*	$NetBSD: path.c,v 1.9 2017/06/22 13:32:04 kamil Exp $	*/
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: path.c,v 1.8 2009/04/25 05:11:37 lukem Exp $");
+__RCSID("$NetBSD: path.c,v 1.9 2017/06/22 13:32:04 kamil Exp $");
 #endif
 
 
@@ -130,10 +130,10 @@ simplify_path(pathx)
 
 	if ((isrooted = ISROOTEDPATH(pathx)))
 		very_start++;
-#if defined (OS2) || defined (__CYGWIN__)
+#if defined (OS2)
 	if (pathx[0] && pathx[1] == ':')	/* skip a: */
 		very_start += 2;
-#endif /* OS2 || __CYGWIN__ */
+#endif /* OS2 */
 
 	/* Before			After
 	 *  /foo/			/foo
@@ -143,19 +143,13 @@ simplify_path(pathx)
 	 *  ....
 	 *  ./foo			foo
 	 *  foo/../../../bar		../../bar
-	 * OS2 and CYGWIN:
+	 * OS2:
 	 *  a:/foo/../..		a:/
 	 *  a:.a:
 	 *  a:..			a:..
 	 *  a:foo/../../blah		a:../blah
 	 */
 
-#ifdef __CYGWIN__
-   /* preserve leading double-slash on pathnames (for UNC paths) */
-   if (pathx[0] && ISDIRSEP(pathx[0]) && pathx[1] && ISDIRSEP(pathx[1]))
-   very_start++;
-#endif /* __CYGWIN__ */
-
 	for (cur = t = start = very_start; ; ) {
 		/* treat multiple '/'s as one '/' */
 		while (ISDIRSEP(*t))

Index: src/bin/ksh/sh.h
diff -u src/bin/ksh/sh.h:1.7 src/bin/ksh/sh.h:1.8
--- src/bin/ksh/sh.h:1.7	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/sh.h	Thu Jun 22 13:32:04 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: sh.h,v 1.7 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: sh.h,v 1.8 2017/06/22 13:32:04 kamil Exp $	*/
 
 /*
  * Public Domain Bourne/Korn shell
  */
 
-/* $Id: sh.h,v 1.7 2005/06/26 19:09:00 christos Exp $ */
+/* $Id: sh.h,v 1.8 2017/06/22 13:32:04 kamil Exp $ */
 
 #include "config.h"	/* system and option configuration info */
 
@@ -323,14 +323,8 @@ extern char *ksh_strrchr_dirsep(const ch
 # define DIRSEP '/'
 # define DIRSEPSTR  "/"
 # define ISDIRSEP(c)((c) == '/')
-#ifdef __CYGWIN__
-#  define ISABSPATH(s) \
-   (((s)[0] && (s)[1] == ':' && ISDIRSEP((s)[2])) || ISDIRSEP((s)[0]))
-#  define ISRELPATH(s) (!(s)[0] || ((s)[1] != ':' && !ISDIRSEP((s)[0])))
-#else /* __CYGWIN__ */
 # define ISABSPATH(s)	ISDIRSEP((s)[0])
 # define ISRELPATH(s)	(!ISABSPATH(s))
-#endif /* __CYGWIN__ */
 # define ISROOTEDPATH(s) ISABSPATH(s)
 # define FILECHCONV(c)	c
 # define FILECMP(s1, s2) strcmp(s1, s2)



CVS commit: src/bin/ksh

2017-05-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  3 00:41:34 UTC 2017

Modified Files:
src/bin/ksh: misc.c

Log Message:
PR/52210: David H. Gutteridge: revert var pattern handling.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.16 src/bin/ksh/misc.c:1.17
--- src/bin/ksh/misc.c:1.16	Sun Apr 30 13:34:29 2017
+++ src/bin/ksh/misc.c	Tue May  2 20:41:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.16 2017/04/30 17:34:29 christos Exp $	*/
+/*	$NetBSD: misc.c,v 1.17 2017/05/03 00:41:34 christos Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: misc.c,v 1.16 2017/04/30 17:34:29 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.17 2017/05/03 00:41:34 christos Exp $");
 #endif
 
 
@@ -683,12 +683,11 @@ do_gmatch(s, se, p, pe, isfile)
 		  case 0x80|'+': /* matches one or more times */
 		  case 0x80|'*': /* matches zero or more times */
 			if (!(prest = pat_scan(++p, pe, 0)))
-break;
-			s--;
+return 0;
 			/* take care of zero matches */
 			if (p[-1] == (0x80 | '*')
 			&& do_gmatch(s, se, prest, pe, isfile))
-continue;
+return 1;
 			for (psub = p; ; psub = pnext) {
 pnext = pat_scan(psub, pe, 1);
 for (srest = s; srest <= se; srest++) {
@@ -704,18 +703,17 @@ do_gmatch(s, se, p, pe, isfile)
 if (pnext == prest)
 	break;
 			}
-			break;
+			return 0;
 
 		  case 0x80|'?': /* matches zero or once */
 		  case 0x80|'@': /* matches one of the patterns */
 		  case 0x80|' ': /* simile for @ */
 			if (!(prest = pat_scan(++p, pe, 0)))
-break;
-			s--;
+return 0;
 			/* Take care of zero matches */
 			if (p[-1] == (0x80 | '?')
 			&& do_gmatch(s, se, prest, pe, isfile))
-continue;
+return 1;
 			for (psub = p; ; psub = pnext) {
 pnext = pat_scan(psub, pe, 1);
 srest = prest == pe ? se : s;
@@ -724,17 +722,16 @@ do_gmatch(s, se, p, pe, isfile)
 		  psub, pnext - 2, isfile)
 	&& do_gmatch(srest, se,
 			 prest, pe, isfile))
-		continue;
+		return 1;
 }
 if (pnext == prest)
 	break;
 			}
-			break;
+			return 0;
 
 		  case 0x80|'!': /* matches none of the patterns */
 			if (!(prest = pat_scan(++p, pe, 0)))
-break;
-			s--;
+return 0;
 			for (srest = s; srest <= se; srest++) {
 int matched = 0;
 
@@ -751,9 +748,9 @@ do_gmatch(s, se, p, pe, isfile)
 }
 if (!matched && do_gmatch(srest, se,
 			  prest, pe, isfile))
-	continue;
+	return 1;
 			}
-			break;
+			return 0;
 
 		  default:
 			if (sc != pc)



CVS commit: src/bin/ksh

2017-04-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 30 17:34:29 UTC 2017

Modified Files:
src/bin/ksh: misc.c

Log Message:
Use backtracking for regular patterns, but not ksh-specific ones [*?!+@](...)
which still use recursion.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.15 src/bin/ksh/misc.c:1.16
--- src/bin/ksh/misc.c:1.15	Sun Oct 16 13:12:11 2011
+++ src/bin/ksh/misc.c	Sun Apr 30 13:34:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.15 2011/10/16 17:12:11 joerg Exp $	*/
+/*	$NetBSD: misc.c,v 1.16 2017/04/30 17:34:29 christos Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: misc.c,v 1.15 2011/10/16 17:12:11 joerg Exp $");
+__RCSID("$NetBSD: misc.c,v 1.16 2017/04/30 17:34:29 christos Exp $");
 #endif
 
 
@@ -631,46 +631,50 @@ do_gmatch(s, se, p, pe, isfile)
 	const unsigned char *se, *pe;
 	int isfile;
 {
-	register int sc, pc;
+	int sc, pc;
 	const unsigned char *prest, *psub, *pnext;
 	const unsigned char *srest;
+	const unsigned char *sNext, *pNext, *sStart;
 
 	if (s == NULL || p == NULL)
 		return 0;
-	while (p < pe) {
-		pc = *p++;
+	sNext = sStart = s;
+	pNext = p;
+	while (p < pe || s < se) {
+		pc = *p;
 		sc = s < se ? *s : '\0';
-		s++;
 		if (isfile) {
 			sc = FILECHCONV((unsigned char)sc);
 			pc = FILECHCONV((unsigned char)pc);
 		}
 		if (!ISMAGIC(pc)) {
 			if (sc != pc)
-return 0;
+goto backtrack;
+			p++;
+			s++;
 			continue;
-		}
-		switch (*p++) {
+		} else
+			pc = *++p;
+		switch (pc) {
 		  case '[':
+			p++;
+			s++;
 			if (sc == 0 || (p = cclass(p, sc)) == NULL)
-return 0;
-			break;
+break;
+			continue;
 
 		  case '?':
 			if (sc == 0)
-return 0;
-			break;
+break;
+			p++;
+			s++;
+			continue;
 
 		  case '*':
-			if (p == pe)
-return 1;
-			s--;
-			do {
-if (do_gmatch(s, se, p, pe, isfile))
-	return 1;
-			} while (s++ < se);
-			return 0;
-
+			pNext = p - 1;
+			sNext = s + 1;
+			p++;
+			continue;
 		  /*
 		   * [*+?@!](pattern|pattern|..)
 		   *
@@ -678,13 +682,13 @@ do_gmatch(s, se, p, pe, isfile)
 		   */
 		  case 0x80|'+': /* matches one or more times */
 		  case 0x80|'*': /* matches zero or more times */
-			if (!(prest = pat_scan(p, pe, 0)))
-return 0;
+			if (!(prest = pat_scan(++p, pe, 0)))
+break;
 			s--;
 			/* take care of zero matches */
 			if (p[-1] == (0x80 | '*')
 			&& do_gmatch(s, se, prest, pe, isfile))
-return 1;
+continue;
 			for (psub = p; ; psub = pnext) {
 pnext = pat_scan(psub, pe, 1);
 for (srest = s; srest <= se; srest++) {
@@ -700,18 +704,18 @@ do_gmatch(s, se, p, pe, isfile)
 if (pnext == prest)
 	break;
 			}
-			return 0;
+			break;
 
 		  case 0x80|'?': /* matches zero or once */
 		  case 0x80|'@': /* matches one of the patterns */
 		  case 0x80|' ': /* simile for @ */
-			if (!(prest = pat_scan(p, pe, 0)))
-return 0;
+			if (!(prest = pat_scan(++p, pe, 0)))
+break;
 			s--;
 			/* Take care of zero matches */
 			if (p[-1] == (0x80 | '?')
 			&& do_gmatch(s, se, prest, pe, isfile))
-return 1;
+continue;
 			for (psub = p; ; psub = pnext) {
 pnext = pat_scan(psub, pe, 1);
 srest = prest == pe ? se : s;
@@ -720,16 +724,16 @@ do_gmatch(s, se, p, pe, isfile)
 		  psub, pnext - 2, isfile)
 	&& do_gmatch(srest, se,
 			 prest, pe, isfile))
-		return 1;
+		continue;
 }
 if (pnext == prest)
 	break;
 			}
-			return 0;
+			break;
 
 		  case 0x80|'!': /* matches none of the patterns */
-			if (!(prest = pat_scan(p, pe, 0)))
-return 0;
+			if (!(prest = pat_scan(++p, pe, 0)))
+break;
 			s--;
 			for (srest = s; srest <= se; srest++) {
 int matched = 0;
@@ -747,17 +751,25 @@ do_gmatch(s, se, p, pe, isfile)
 }
 if (!matched && do_gmatch(srest, se,
 			  prest, pe, isfile))
-	return 1;
+	continue;
 			}
-			return 0;
+			break;
 
 		  default:
-			if (sc != p[-1])
-return 0;
-			break;
+			if (sc != pc)
+break;
+			p++;
+			s++;
+			continue;
 		}
+backtrack:	if (sNext != sStart && sNext <= se) {
+			p = pNext;
+			s = sNext;
+			continue;
+		}
+		return 0;
 	}
-	return s == se;
+	return 1;
 }
 
 static const unsigned char *



CVS commit: src/bin/ksh

2017-01-14 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Jan 14 18:35:43 UTC 2017

Modified Files:
src/bin/ksh: history.c

Log Message:
reorganize the code so we test if open fails at the open call.
this doesn't actually make a functional difference as ftruncate can
handle it, but it's a bit clearer and appeases static analyzers.

ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/history.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/history.c
diff -u src/bin/ksh/history.c:1.11 src/bin/ksh/history.c:1.12
--- src/bin/ksh/history.c:1.11	Wed Aug 31 16:24:54 2011
+++ src/bin/ksh/history.c	Sat Jan 14 18:35:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: history.c,v 1.12 2017/01/14 18:35:43 maya Exp $	*/
 
 /*
  * command history
@@ -19,7 +19,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: history.c,v 1.11 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: history.c,v 1.12 2017/01/14 18:35:43 maya Exp $");
 #endif
 
 
@@ -757,13 +757,14 @@ hist_finish()
   else
 hp = histlist;
 
-  fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777);
-  /* Remove anything written before we got the lock */
-  ftruncate(fd, 0);
-  if (fd >= 0 && (fh = fdopen(fd, "w"))) {
-for (i = 0; hp + i <= histptr && hp[i]; i++)
-  fprintf(fh, "%s%c", hp[i], '\0');
-fclose(fh);
+  if ((fd = open(hname, O_WRONLY | O_CREAT | O_TRUNC | O_EXLOCK, 0777)) != -1) {
+/* Remove anything written before we got the lock */
+ftruncate(fd, 0);
+if ((fh = fdopen(fd, "w")) != NULL) {
+  for (i = 0; hp + i <= histptr && hp[i]; i++)
+fprintf(fh, "%s%c", hp[i], '\0');
+  fclose(fh);
+}
   }
 }
 



CVS commit: src/bin/ksh

2016-10-11 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Oct 11 06:31:07 UTC 2016

Modified Files:
src/bin/ksh: c_sh.c

Log Message:
PR 49595 William Ahern: The exit status of "unset NOTSET" should be 0, not 1.
(like 48312 but for ksh)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/c_sh.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_sh.c
diff -u src/bin/ksh/c_sh.c:1.15 src/bin/ksh/c_sh.c:1.16
--- src/bin/ksh/c_sh.c:1.15	Fri Oct 18 19:53:34 2013
+++ src/bin/ksh/c_sh.c	Tue Oct 11 06:31:07 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_sh.c,v 1.15 2013/10/18 19:53:34 christos Exp $	*/
+/*	$NetBSD: c_sh.c,v 1.16 2016/10/11 06:31:07 dholland Exp $	*/
 
 /*
  * built-in Bourne commands
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: c_sh.c,v 1.15 2013/10/18 19:53:34 christos Exp $");
+__RCSID("$NetBSD: c_sh.c,v 1.16 2016/10/11 06:31:07 dholland Exp $");
 #endif
 
 
@@ -691,8 +691,6 @@ c_unset(wp)
 		if (unset_var) {	/* unset variable */
 			struct tbl *vp = global(id);
 
-			if (!(vp->flag & ISSET))
-			ret = 1;
 			if ((vp->flag)) {
 bi_errorf("%s is read only", vp->name);
 return 1;



CVS commit: src/bin/ksh

2016-10-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Oct  4 15:09:03 UTC 2016

Modified Files:
src/bin/ksh: eval.c

Log Message:
Add explicit char cast to show that the value change is intended.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.15 src/bin/ksh/eval.c:1.16
--- src/bin/ksh/eval.c:1.15	Fri Oct 18 19:53:34 2013
+++ src/bin/ksh/eval.c	Tue Oct  4 15:09:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.15 2013/10/18 19:53:34 christos Exp $	*/
+/*	$NetBSD: eval.c,v 1.16 2016/10/04 15:09:03 joerg Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: eval.c,v 1.15 2013/10/18 19:53:34 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.16 2016/10/04 15:09:03 joerg Exp $");
 #endif
 
 #include 
@@ -345,7 +345,7 @@ expand(cp, wp, f)
 		 * expected)
 		 */
 		*dp++ = MAGIC;
-		*dp++ = '@' + 0x80;
+		*dp++ = (char)('@' + 0x80);
 		break;
 	  case '=':
 		/* Enabling tilde expansion



CVS commit: src/bin/ksh

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 17 13:54:32 UTC 2016

Modified Files:
src/bin/ksh: siglist.sh

Log Message:
put back the complex sed/awk since the code can't handle unsorted or repeated
entries (Rin Okuyama)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/siglist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/siglist.sh
diff -u src/bin/ksh/siglist.sh:1.10 src/bin/ksh/siglist.sh:1.11
--- src/bin/ksh/siglist.sh:1.10	Wed Mar 16 19:01:33 2016
+++ src/bin/ksh/siglist.sh	Thu Mar 17 09:54:31 2016
@@ -1,14 +1,46 @@
 #!/bin/sh
-#	$NetBSD: siglist.sh,v 1.10 2016/03/16 23:01:33 christos Exp $
+#	$NetBSD: siglist.sh,v 1.11 2016/03/17 13:54:31 christos Exp $
 #
 # Script to generate a sorted, complete list of signals, suitable
 # for inclusion in trap.c as array initializer.
 #
 
+set -e
+
+: ${AWK:=awk}
 : ${SED:=sed}
 
-# The trap here to make up for a bug in bash (1.14.3(1)) that calls the trap
+in=tmpi$$.c
+out=tmpo$$.c
+ecode=1
+trapsigs='0 1 2 13 15'
+trap 'rm -f $in $out; trap 0; exit $ecode' $trapsigs
 
-${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
-	{ .signal = SIG\1 , .name = "\1", .mess = "\2" },\
-#endif/'
+CPP="${1-cc -E}"
+
+# The trap here to make up for a bug in bash (1.14.3(1)) that calls the trap
+(trap $trapsigs;
+ echo '#include "sh.h"';
+ echo '	{ QwErTy SIGNALS , "DUMMY" , "hook for number of signals" },';
+ ${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
+	{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
+#endif/') > $in
+# work around for gcc 5
+$CPP $in | grep -v '^#' | tr -d '\n' | sed 's/},/},\
+/g' > $out
+${SED} -n 's/{ QwErTy/{/p' < $out | ${AWK} '{print NR, $0}' | sort -k 5n -k 1n |
+${SED} 's/^[0-9]* //' |
+${AWK} 'BEGIN { last=0; nsigs=0; }
+	{
+	if ($4 ~ /^[0-9][0-9]*$/ && $5 == ",") {
+		n = $4;
+		if (n > 0 && n != last) {
+		while (++last < n) {
+			printf "\t{ .signal = %d , .name = NULL, .mess = `Signal %d` } ,\n", last, last;
+		}
+		print;
+		}
+	}
+	}' |
+tr '`' '"' | grep -v '"DUMMY"'
+ecode=0



CVS commit: src/bin/ksh

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 23:01:34 UTC 2016

Modified Files:
src/bin/ksh: Makefile siglist.sh

Log Message:
We don't need all this magic to build the signals lists. Do the work at
compile time.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/ksh/Makefile
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/siglist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.31 src/bin/ksh/Makefile:1.32
--- src/bin/ksh/Makefile:1.31	Thu Jan 29 15:46:31 2015
+++ src/bin/ksh/Makefile	Wed Mar 16 19:01:33 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.31 2015/01/29 20:46:31 joerg Exp $
+#	$NetBSD: Makefile,v 1.32 2016/03/16 23:01:33 christos Exp $
 
 WARNS=3
 CWARNFLAGS.clang+=	-Wno-error=cast-qual
@@ -22,7 +22,6 @@ USETBL= 
 
 # Environment for scripts executed during build.
 SCRIPT_ENV= \
-	AWK=${TOOL_AWK:Q} \
 	SED=${TOOL_SED:Q}
 
 CLEANFILES+=	siglist.out siglist.out.tmp

Index: src/bin/ksh/siglist.sh
diff -u src/bin/ksh/siglist.sh:1.9 src/bin/ksh/siglist.sh:1.10
--- src/bin/ksh/siglist.sh:1.9	Sun Jan 23 12:11:55 2011
+++ src/bin/ksh/siglist.sh	Wed Mar 16 19:01:33 2016
@@ -1,44 +1,14 @@
 #!/bin/sh
-#	$NetBSD: siglist.sh,v 1.9 2011/01/23 17:11:55 hauke Exp $
+#	$NetBSD: siglist.sh,v 1.10 2016/03/16 23:01:33 christos Exp $
 #
 # Script to generate a sorted, complete list of signals, suitable
 # for inclusion in trap.c as array initializer.
 #
 
-set -e
-
-: ${AWK:=awk}
 : ${SED:=sed}
 
-in=tmpi$$.c
-out=tmpo$$.c
-ecode=1
-trapsigs='0 1 2 13 15'
-trap 'rm -f $in $out; trap 0; exit $ecode' $trapsigs
-
-CPP="${1-cc -E}"
-
 # The trap here to make up for a bug in bash (1.14.3(1)) that calls the trap
-(trap $trapsigs;
- echo '#include "sh.h"';
- echo '	{ QwErTy SIGNALS , "DUMMY" , "hook for number of signals" },';
- ${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
-	{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
-#endif/') > $in
-$CPP $in  > $out
-${SED} -n 's/{ QwErTy/{/p' < $out | ${AWK} '{print NR, $0}' | sort -k 5n -k 1n |
-${SED} 's/^[0-9]* //' |
-${AWK} 'BEGIN { last=0; nsigs=0; }
-	{
-	if ($4 ~ /^[0-9][0-9]*$/ && $5 == ",") {
-		n = $4;
-		if (n > 0 && n != last) {
-		while (++last < n) {
-			printf "\t{ .signal = %d , .name = NULL, .mess = `Signal %d` } ,\n", last, last;
-		}
-		print;
-		}
-	}
-	}' |
-tr '`' '"' | grep -v '"DUMMY"'
-ecode=0
+
+${SED} -e '/^[	 ]*#/d' -e 's/^[	 ]*\([^ 	][^ 	]*\)[	 ][	 ]*\(.*[^ 	]\)[ 	]*$/#ifdef SIG\1\
+	{ .signal = SIG\1 , .name = "\1", .mess = "\2" },\
+#endif/'



CVS commit: src/bin/ksh

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 23:02:23 UTC 2016

Modified Files:
src/bin/ksh: Makefile

Log Message:
Put back awk, other scripts need it.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/ksh/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.32 src/bin/ksh/Makefile:1.33
--- src/bin/ksh/Makefile:1.32	Wed Mar 16 19:01:33 2016
+++ src/bin/ksh/Makefile	Wed Mar 16 19:02:23 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2016/03/16 23:01:33 christos Exp $
+#	$NetBSD: Makefile,v 1.33 2016/03/16 23:02:23 christos Exp $
 
 WARNS=3
 CWARNFLAGS.clang+=	-Wno-error=cast-qual
@@ -22,6 +22,7 @@ USETBL= 
 
 # Environment for scripts executed during build.
 SCRIPT_ENV= \
+	AWK=${TOOL_AWK:Q} \
 	SED=${TOOL_SED:Q}
 
 CLEANFILES+=	siglist.out siglist.out.tmp



CVS commit: src/bin/ksh

2016-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 17 13:59:02 UTC 2016

Modified Files:
src/bin/ksh: siglist.sh

Log Message:
s/sed/${SED}/


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/siglist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/siglist.sh
diff -u src/bin/ksh/siglist.sh:1.11 src/bin/ksh/siglist.sh:1.12
--- src/bin/ksh/siglist.sh:1.11	Thu Mar 17 09:54:31 2016
+++ src/bin/ksh/siglist.sh	Thu Mar 17 09:59:02 2016
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: siglist.sh,v 1.11 2016/03/17 13:54:31 christos Exp $
+#	$NetBSD: siglist.sh,v 1.12 2016/03/17 13:59:02 christos Exp $
 #
 # Script to generate a sorted, complete list of signals, suitable
 # for inclusion in trap.c as array initializer.
@@ -26,7 +26,7 @@ CPP="${1-cc -E}"
 	{ QwErTy .signal = SIG\1 , .name = "\1", .mess = "\2" },\
 #endif/') > $in
 # work around for gcc 5
-$CPP $in | grep -v '^#' | tr -d '\n' | sed 's/},/},\
+$CPP $in | grep -v '^#' | tr -d '\n' | ${SED} 's/},/},\
 /g' > $out
 ${SED} -n 's/{ QwErTy/{/p' < $out | ${AWK} '{print NR, $0}' | sort -k 5n -k 1n |
 ${SED} 's/^[0-9]* //' |



CVS commit: src/bin/ksh

2016-02-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb  3 05:26:16 UTC 2016

Modified Files:
src/bin/ksh: vi.c

Log Message:
PR/50747: David Binderman: check bounds before dereference.
While here add some continues before semicolons.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/vi.c
diff -u src/bin/ksh/vi.c:1.12 src/bin/ksh/vi.c:1.13
--- src/bin/ksh/vi.c:1.12	Tue Jun 21 23:56:17 2011
+++ src/bin/ksh/vi.c	Wed Feb  3 00:26:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vi.c,v 1.12 2011/06/22 03:56:17 mrg Exp $	*/
+/*	$NetBSD: vi.c,v 1.13 2016/02/03 05:26:16 christos Exp $	*/
 
 /*
  *	vi command editing
@@ -9,7 +9,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: vi.c,v 1.12 2011/06/22 03:56:17 mrg Exp $");
+__RCSID("$NetBSD: vi.c,v 1.13 2016/02/03 05:26:16 christos Exp $");
 #endif
 
 #include "config.h"
@@ -835,7 +835,7 @@ vi_cmd(argcnt, cmd)
 		(cmd[1]=='w' || cmd[1]=='W') &&
 		!isspace((unsigned char)es->cbuf[es->cursor])) {
 	while (isspace((unsigned char)es->cbuf[--ncursor]))
-		;
+		continue;
 	ncursor++;
 }
 if (ncursor > es->cursor) {
@@ -865,7 +865,7 @@ vi_cmd(argcnt, cmd)
 			if (es->linelen != 0)
 es->cursor++;
 			while (putbuf(ybuf, yanklen, 0) == 0 && --argcnt > 0)
-;
+continue;
 			if (es->cursor != 0)
 es->cursor--;
 			if (argcnt != 0)
@@ -1572,15 +1572,16 @@ forwword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor < es->linelen && argcnt--) {
 		if (is_wordch(es->cbuf[ncursor]))
-			while (is_wordch(es->cbuf[ncursor]) &&
-	ncursor < es->linelen)
+			while (ncursor < es->linelen &&
+			is_wordch(es->cbuf[ncursor]))
 ncursor++;
 		else if (!isspace((unsigned char)es->cbuf[ncursor]))
-			while (!is_wordch(es->cbuf[ncursor]) &&
-	!isspace((unsigned char)es->cbuf[ncursor]) &&
-	ncursor < es->linelen)
+			while (ncursor < es->linelen &&
+			!is_wordch(es->cbuf[ncursor]) &&
+			!isspace((unsigned char)es->cbuf[ncursor]))
 ncursor++;
-		while (isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
+		while (ncursor < es->linelen &&
+		isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor++;
 	}
 	return ncursor;
@@ -1595,17 +1596,17 @@ backword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor > 0 && argcnt--) {
 		while (--ncursor > 0 && isspace((unsigned char)es->cbuf[ncursor]))
-			;
+			continue;
 		if (ncursor > 0) {
 			if (is_wordch(es->cbuf[ncursor]))
 while (--ncursor >= 0 &&
    is_wordch(es->cbuf[ncursor]))
-	;
+	continue;
 			else
 while (--ncursor >= 0 &&
    !is_wordch(es->cbuf[ncursor]) &&
    !isspace((unsigned char)es->cbuf[ncursor]))
-	;
+	continue;
 			ncursor++;
 		}
 	}
@@ -1621,18 +1622,18 @@ endword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor < es->linelen && argcnt--) {
 		while (++ncursor < es->linelen - 1 &&
-isspace((unsigned char)es->cbuf[ncursor]))
-			;
+		isspace((unsigned char)es->cbuf[ncursor]))
+			continue;
 		if (ncursor < es->linelen - 1) {
 			if (is_wordch(es->cbuf[ncursor]))
 while (++ncursor < es->linelen &&
-	  is_wordch(es->cbuf[ncursor]))
-	;
+is_wordch(es->cbuf[ncursor]))
+	continue;
 			else
 while (++ncursor < es->linelen &&
    !is_wordch(es->cbuf[ncursor]) &&
    !isspace((unsigned char)es->cbuf[ncursor]))
-	;
+	continue;
 			ncursor--;
 		}
 	}
@@ -1647,9 +1648,11 @@ Forwword(argcnt)
 
 	ncursor = es->cursor;
 	while (ncursor < es->linelen && argcnt--) {
-		while (!isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
+		while (ncursor < es->linelen &&
+		!isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor++;
-		while (isspace((unsigned char)es->cbuf[ncursor]) && ncursor < es->linelen)
+		while (ncursor < es->linelen &&
+		isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor++;
 	}
 	return ncursor;
@@ -1664,7 +1667,7 @@ Backword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor > 0 && argcnt--) {
 		while (--ncursor >= 0 && isspace((unsigned char)es->cbuf[ncursor]))
-			;
+			continue;
 		while (ncursor >= 0 && !isspace((unsigned char)es->cbuf[ncursor]))
 			ncursor--;
 		ncursor++;
@@ -1681,12 +1684,12 @@ Endword(argcnt)
 	ncursor = es->cursor;
 	while (ncursor < es->linelen - 1 && argcnt--) {
 		while (++ncursor < es->linelen - 1 &&
-isspace((unsigned char)es->cbuf[ncursor]))
-			;
+		isspace((unsigned char)es->cbuf[ncursor]))
+			continue;
 		if (ncursor < es->linelen - 1) {
 			while (++ncursor < es->linelen &&
-	!isspace((unsigned char)es->cbuf[ncursor]))
-;
+			!isspace((unsigned char)es->cbuf[ncursor]))
+continue;
 			ncursor--;
 		}
 	}



CVS commit: src/bin/ksh

2015-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 30 22:26:26 UTC 2015

Modified Files:
src/bin/ksh: ksh.Man

Log Message:
We don't have RLIMIT_SWAP


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/ksh.Man

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/ksh.Man
diff -u src/bin/ksh/ksh.Man:1.24 src/bin/ksh/ksh.Man:1.25
--- src/bin/ksh/ksh.Man:1.24	Sun Apr 12 13:05:03 2015
+++ src/bin/ksh/ksh.Man	Wed Dec 30 17:26:26 2015
@@ -1,5 +1,5 @@
 '\" t
-.\" $NetBSD: ksh.Man,v 1.24 2015/04/12 17:05:03 jmcneill Exp $
+.\" $NetBSD: ksh.Man,v 1.25 2015/12/30 22:26:26 christos Exp $
 .\"{{{}}}
 .\"{{{  Notes about man page
 .\" - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
@@ -2653,6 +2653,7 @@ on some systems this is the maximum allo
 not kbytes).
 .IP \fB\-w\fP
 Impose a limit of \fIn\fP kbytes on the amount of swap space used.
+(Not supported on NetBSD)
 .PP
 As far as \fBulimit\fP is concerned, a block is 512 bytes.
 .RE



CVS commit: src/bin/ksh

2015-05-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  9 13:26:06 UTC 2015

Modified Files:
src/bin/ksh: c_ulimit.c

Log Message:
CID 1225088: check return of getrlimit


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/c_ulimit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ulimit.c
diff -u src/bin/ksh/c_ulimit.c:1.11 src/bin/ksh/c_ulimit.c:1.12
--- src/bin/ksh/c_ulimit.c:1.11	Sat May  9 09:22:37 2015
+++ src/bin/ksh/c_ulimit.c	Sat May  9 09:26:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ulimit.c,v 1.11 2015/05/09 13:22:37 christos Exp $	*/
+/*	$NetBSD: c_ulimit.c,v 1.12 2015/05/09 13:26:06 christos Exp $	*/
 
 /*
 	ulimit -- handle ulimit builtin
@@ -20,7 +20,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: c_ulimit.c,v 1.11 2015/05/09 13:22:37 christos Exp $);
+__RCSID($NetBSD: c_ulimit.c,v 1.12 2015/05/09 13:26:06 christos Exp $);
 #endif
 
 
@@ -203,9 +203,12 @@ c_ulimit(wp)
 		for (l = limits; l-name; l++) {
 #ifdef HAVE_SETRLIMIT
 			if (l-which == RLIMIT) {
-if (getrlimit(l-gcmd, limit) == -1)
-	val = RLIM_INFINITY;
-else if (how  SOFT)
+if (getrlimit(l-gcmd, limit) == -1) {
+	bi_errorf(can't get limit: %s,
+	strerror(errno));
+	return 1;
+}
+if (how  SOFT)
 	val = limit.rlim_cur;
 else if (how  HARD)
 	val = limit.rlim_max;
@@ -233,7 +236,10 @@ c_ulimit(wp)
 	}
 #ifdef HAVE_SETRLIMIT
 	if (l-which == RLIMIT) {
-		getrlimit(l-gcmd, limit);
+		if (getrlimit(l-gcmd, limit) == -1) {
+			bi_errorf(can't get limit: %s, strerror(errno));
+			return 1;
+		}
 		if (set) {
 			if (how  SOFT)
 limit.rlim_cur = val;



CVS commit: src/bin/ksh

2015-05-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  9 13:22:37 UTC 2015

Modified Files:
src/bin/ksh: c_ulimit.c

Log Message:
CID 1225077: check getrlimit return


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/ksh/c_ulimit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ulimit.c
diff -u src/bin/ksh/c_ulimit.c:1.10 src/bin/ksh/c_ulimit.c:1.11
--- src/bin/ksh/c_ulimit.c:1.10	Fri Jun  8 22:51:50 2012
+++ src/bin/ksh/c_ulimit.c	Sat May  9 09:22:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ulimit.c,v 1.10 2012/06/09 02:51:50 christos Exp $	*/
+/*	$NetBSD: c_ulimit.c,v 1.11 2015/05/09 13:22:37 christos Exp $	*/
 
 /*
 	ulimit -- handle ulimit builtin
@@ -20,7 +20,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: c_ulimit.c,v 1.10 2012/06/09 02:51:50 christos Exp $);
+__RCSID($NetBSD: c_ulimit.c,v 1.11 2015/05/09 13:22:37 christos Exp $);
 #endif
 
 
@@ -203,8 +203,9 @@ c_ulimit(wp)
 		for (l = limits; l-name; l++) {
 #ifdef HAVE_SETRLIMIT
 			if (l-which == RLIMIT) {
-getrlimit(l-gcmd, limit);
-if (how  SOFT)
+if (getrlimit(l-gcmd, limit) == -1)
+	val = RLIM_INFINITY;
+else if (how  SOFT)
 	val = limit.rlim_cur;
 else if (how  HARD)
 	val = limit.rlim_max;



CVS commit: src/bin/ksh

2015-04-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 12 17:05:03 UTC 2015

Modified Files:
src/bin/ksh: ksh.Man

Log Message:
document ulimit -r


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/ksh.Man

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/ksh.Man
diff -u src/bin/ksh/ksh.Man:1.23 src/bin/ksh/ksh.Man:1.24
--- src/bin/ksh/ksh.Man:1.23	Tue Oct 18 12:36:31 2011
+++ src/bin/ksh/ksh.Man	Sun Apr 12 17:05:03 2015
@@ -1,5 +1,5 @@
 '\ t
-.\ $NetBSD: ksh.Man,v 1.23 2011/10/18 12:36:31 reed Exp $
+.\ $NetBSD: ksh.Man,v 1.24 2015/04/12 17:05:03 jmcneill Exp $
 .\{{{}}}
 .\{{{  Notes about man page
 .\ - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
@@ -19,10 +19,10 @@
 .\}}}
 .\{{{  Title
 .ksh(
-.TH KSH 1 August 19, 1996  User commands
+.TH KSH 1 April 12, 2015  User commands
 .ksh)
 .sh(
-.TH SH 1 August 19, 1996  User commands
+.TH SH 1 April 12, 2015  User commands
 .sh)
 .\}}}
 .\{{{  Name
@@ -2602,8 +2602,8 @@ Exported functions are not implemented y
 T}
 .TE
 .\}}}
-.\{{{  ulimit [-abcdfHlmnpsStvw] [value]
-.IP \fBulimit\fP [\fB\-abcdfHlmnpsStvw\fP] [\fIvalue\fP]
+.\{{{  ulimit [-abcdfHlmnprsStvw] [value]
+.IP \fBulimit\fP [\fB\-abcdfHlmnprsStvw\fP] [\fIvalue\fP]
 Display or set process limits.
 If no options are used, the file size limit (\fB\-f\fP) is assumed.
 \fBvalue\fP, if specified, may be either be an arithmetic expression or the
@@ -2637,6 +2637,9 @@ memory.
 Impose a limit of \fIn\fP kbytes on the amount of physical memory used.
 .IP \fB\-n\fP
 Impose a limit of \fIn\fP file descriptors that can be open at once.
+.IP \fB\-r\fP
+Impose a limit of \fIn\fP threads that can be run by the user at any one
+time.
 .IP \fB\-p\fP
 Impose a limit of \fIn\fP processes that can be run by the user at any one
 time.



CVS commit: src/bin/ksh

2015-01-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Jan 29 20:46:31 UTC 2015

Modified Files:
src/bin/ksh: Makefile

Log Message:
Make cast warnings for clang non-fatal.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/ksh/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.30 src/bin/ksh/Makefile:1.31
--- src/bin/ksh/Makefile:1.30	Sun Oct 16 17:12:11 2011
+++ src/bin/ksh/Makefile	Thu Jan 29 20:46:31 2015
@@ -1,6 +1,7 @@
-#	$NetBSD: Makefile,v 1.30 2011/10/16 17:12:11 joerg Exp $
+#	$NetBSD: Makefile,v 1.31 2015/01/29 20:46:31 joerg Exp $
 
 WARNS=3
+CWARNFLAGS.clang+=	-Wno-error=cast-qual
 
 .include bsd.own.mk
 



CVS commit: src/bin/ksh

2012-06-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun  9 02:51:50 UTC 2012

Modified Files:
src/bin/ksh: c_ulimit.c

Log Message:
support RLIMIT_NTHR


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/c_ulimit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/c_ulimit.c
diff -u src/bin/ksh/c_ulimit.c:1.9 src/bin/ksh/c_ulimit.c:1.10
--- src/bin/ksh/c_ulimit.c:1.9	Sun Sep 14 01:00:23 2008
+++ src/bin/ksh/c_ulimit.c	Fri Jun  8 22:51:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ulimit.c,v 1.9 2008/09/14 05:00:23 sjg Exp $	*/
+/*	$NetBSD: c_ulimit.c,v 1.10 2012/06/09 02:51:50 christos Exp $	*/
 
 /*
 	ulimit -- handle ulimit builtin
@@ -20,7 +20,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: c_ulimit.c,v 1.9 2008/09/14 05:00:23 sjg Exp $);
+__RCSID($NetBSD: c_ulimit.c,v 1.10 2012/06/09 02:51:50 christos Exp $);
 #endif
 
 
@@ -100,6 +100,9 @@ c_ulimit(wp)
 #ifdef RLIMIT_NPROC
 		{ processes, RLIMIT, RLIMIT_NPROC, RLIMIT_NPROC, 1, 'p' },
 #endif
+#ifdef RLIMIT_NTHR
+		{ threads, RLIMIT, RLIMIT_NTHR, RLIMIT_NTHR, 1, 'r' },
+#endif
 #ifdef RLIMIT_VMEM
 		{ vmemory(kbytes), RLIMIT, RLIMIT_VMEM, RLIMIT_VMEM, 1024, 'v' },
 #else /* RLIMIT_VMEM */



CVS commit: src/bin/ksh

2012-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 25 17:23:49 UTC 2012

Modified Files:
src/bin/ksh: exec.c

Log Message:
PR/6764: Charles M. Hannum: `trap 0' does not work in ksh subshells. When
subshells exit normally, use unwind(LEXIT) instead of unwind(LLEAVE) so that
traps get executed.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/exec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.14 src/bin/ksh/exec.c:1.15
--- src/bin/ksh/exec.c:1.14	Sun Oct 16 13:12:11 2011
+++ src/bin/ksh/exec.c	Sun Mar 25 13:23:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $	*/
+/*	$NetBSD: exec.c,v 1.15 2012/03/25 17:23:48 christos Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $);
+__RCSID($NetBSD: exec.c,v 1.15 2012/03/25 17:23:48 christos Exp $);
 #endif
 
 
@@ -457,6 +457,7 @@ comexec(t, tp, ap, flags)
 	int volatile flags;
 {
 	int i;
+	int leave = LLEAVE;
 	volatile int rv = 0;
 	register char *cp;
 	register char **lastp;
@@ -745,10 +746,11 @@ comexec(t, tp, ap, flags)
 		rv = exchild(texec, flags, -1);
 		break;
 	}
+	leave = LEXIT;
   Leave:
 	if (flags  XEXEC) {
 		exstat = rv;
-		unwind(LLEAVE);
+		unwind(leave);
 	}
 	return rv;
 }



CVS commit: src/bin/ksh

2011-10-16 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Oct 16 17:12:11 UTC 2011

Modified Files:
src/bin/ksh: Makefile c_ksh.c exec.c expr.c jobs.c lex.c main.c misc.c
var.c

Log Message:
Don't use non-literal format strings.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/ksh/Makefile
cvs rdiff -u -r1.17 -r1.18 src/bin/ksh/c_ksh.c
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/exec.c
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/expr.c
cvs rdiff -u -r1.9 -r1.10 src/bin/ksh/jobs.c
cvs rdiff -u -r1.14 -r1.15 src/bin/ksh/lex.c src/bin/ksh/main.c \
src/bin/ksh/misc.c
cvs rdiff -u -r1.16 -r1.17 src/bin/ksh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.29 src/bin/ksh/Makefile:1.30
--- src/bin/ksh/Makefile:1.29	Sun Aug 14 10:40:25 2011
+++ src/bin/ksh/Makefile	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.29 2011/08/14 10:40:25 christos Exp $
+#	$NetBSD: Makefile,v 1.30 2011/10/16 17:12:11 joerg Exp $
 
 WARNS=3
 
@@ -47,6 +47,4 @@ ksh.1: ksh.Man mkman
 	${HOST_SH} $(.CURDIR)/mkman ksh $(.CURDIR)/ksh.Man ksh.1.tmp \
 	 mv ksh.1.tmp ksh.1
 
-CWARNFLAGS.clang+=	-Wno-format-security
-
 .include bsd.prog.mk

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.17 src/bin/ksh/c_ksh.c:1.18
--- src/bin/ksh/c_ksh.c:1.17	Wed Aug 31 16:24:54 2011
+++ src/bin/ksh/c_ksh.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.17 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.18 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: c_ksh.c,v 1.17 2011/08/31 16:24:54 plunky Exp $);
+__RCSID($NetBSD: c_ksh.c,v 1.18 2011/10/16 17:12:11 joerg Exp $);
 #endif
 
 #include sh.h
@@ -573,7 +573,7 @@ c_whence(wp)
 			break;
 		}
 		if (vflag || !ret)
-			shprintf(newline);
+			shprintf(%s, newline);
 	}
 	return ret;
 }
@@ -873,7 +873,7 @@ c_typeset(wp)
 else
 print_value_quoted(s);
 			}
-			shprintf(newline);
+			shprintf(%s, newline);
 			}
 			/* Only report first `element' of an array with
 			 * no set elements.
@@ -964,7 +964,7 @@ c_alias(wp)
 	shf_putc('=', shl_stdout);
 	print_value_quoted(ap-val.s);
 }
-shprintf(newline);
+shprintf(%s, newline);
 			}
 	}
 
@@ -988,7 +988,7 @@ c_alias(wp)
 	shf_putc('=', shl_stdout);
 	print_value_quoted(ap-val.s);
 }
-shprintf(newline);
+shprintf(%s, newline);
 			} else {
 shprintf(%s alias not found\n, alias);
 rv = 1;
@@ -1236,7 +1236,7 @@ c_kill(wp)
 usage: kill [ -s signame | -signum | -signame ] {pid|job}...\n\
kill -l [exit_status]\n
 			);
-		bi_errorf(null);
+		bi_errorf(%s, null);
 		return 1;
 	}
 
@@ -1257,7 +1257,7 @@ c_kill(wp)
 			for (i = 1; i  SIGNALS; i++, p = space)
 if (sigtraps[i].name)
 	shprintf(%s%s, p, sigtraps[i].name);
-			shprintf(newline);
+			shprintf(%s, newline);
 		} else {
 			int w, si;
 			int mess_width;

Index: src/bin/ksh/exec.c
diff -u src/bin/ksh/exec.c:1.13 src/bin/ksh/exec.c:1.14
--- src/bin/ksh/exec.c:1.13	Mon Apr 24 19:58:20 2006
+++ src/bin/ksh/exec.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.13 2006/04/24 19:58:20 christos Exp $	*/
+/*	$NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * execute command tree
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: exec.c,v 1.13 2006/04/24 19:58:20 christos Exp $);
+__RCSID($NetBSD: exec.c,v 1.14 2011/10/16 17:12:11 joerg Exp $);
 #endif
 
 
@@ -151,7 +151,7 @@ execute(t, flags)
  */
 if (tp  tp-type == CSHELL
  (tp-flag  SPEC_BI))
-	errorf(null);
+	errorf(%s, null);
 /* Deal with FERREXIT, quitenv(), etc. */
 goto Break;
 			}

Index: src/bin/ksh/expr.c
diff -u src/bin/ksh/expr.c:1.8 src/bin/ksh/expr.c:1.9
--- src/bin/ksh/expr.c:1.8	Sun Jun 26 19:09:00 2005
+++ src/bin/ksh/expr.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: expr.c,v 1.8 2005/06/26 19:09:00 christos Exp $	*/
+/*	$NetBSD: expr.c,v 1.9 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * Korn expression evaluation
@@ -9,7 +9,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: expr.c,v 1.8 2005/06/26 19:09:00 christos Exp $);
+__RCSID($NetBSD: expr.c,v 1.9 2011/10/16 17:12:11 joerg Exp $);
 #endif
 
 
@@ -193,7 +193,7 @@ v_evaluate(vp, expr, error_ok)
 		if (i == LAEXPR) {
 			if (error_ok == KSH_RETURN_ERROR)
 return 0;
-			errorf(null);
+			errorf(%s, null);
 		}
 		unwind(i);
 		/*NOTREACHED*/

Index: src/bin/ksh/jobs.c
diff -u src/bin/ksh/jobs.c:1.9 src/bin/ksh/jobs.c:1.10
--- src/bin/ksh/jobs.c:1.9	Sat Feb 25 00:58:34 2006
+++ src/bin/ksh/jobs.c	Sun Oct 16 17:12:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.9 2006/02/25 00:58:34 wiz Exp $	*/
+/*	$NetBSD: jobs.c,v 1.10 2011/10/16 17:12:11 joerg Exp $	*/
 
 /*
  * 

CVS commit: src/bin/ksh

2011-10-15 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Sun Oct 16 00:32:25 UTC 2011

Modified Files:
src/bin/ksh: var.c

Log Message:
Typo in comment fix from Snader_LB via IRC.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/ksh/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/var.c
diff -u src/bin/ksh/var.c:1.15 src/bin/ksh/var.c:1.16
--- src/bin/ksh/var.c:1.15	Sun Aug  2 21:24:18 2009
+++ src/bin/ksh/var.c	Sun Oct 16 00:32:25 2011
@@ -1,9 +1,9 @@
-/*	$NetBSD: var.c,v 1.15 2009/08/02 21:24:18 dsl Exp $	*/
+/*	$NetBSD: var.c,v 1.16 2011/10/16 00:32:25 reed Exp $	*/
 
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: var.c,v 1.15 2009/08/02 21:24:18 dsl Exp $);
+__RCSID($NetBSD: var.c,v 1.16 2011/10/16 00:32:25 reed Exp $);
 #endif
 
 
@@ -634,7 +634,7 @@ typeset(var, set, clr, field, base)
 		/* IMPORT is only used when the shell starts up and is
 		 * setting up its environment.  Allow only simple array
 		 * references at this time since parameter/command substitution
-		 * is preformed on the [expression], which would be a major
+		 * is performed on the [expression], which would be a major
 		 * security hole.
 		 */
 		if (set  IMPORT) {



CVS commit: src/bin/ksh

2011-08-21 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug 21 21:24:35 UTC 2011

Modified Files:
src/bin/ksh: eval.c

Log Message:
Requires stdint.h.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.13 src/bin/ksh/eval.c:1.14
--- src/bin/ksh/eval.c:1.13	Sun Aug 14 10:40:25 2011
+++ src/bin/ksh/eval.c	Sun Aug 21 21:24:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.13 2011/08/14 10:40:25 christos Exp $	*/
+/*	$NetBSD: eval.c,v 1.14 2011/08/21 21:24:34 dholland Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,12 +6,13 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: eval.c,v 1.13 2011/08/14 10:40:25 christos Exp $);
+__RCSID($NetBSD: eval.c,v 1.14 2011/08/21 21:24:34 dholland Exp $);
 #endif
 
+#include stdint.h
+#include pwd.h
 
 #include sh.h
-#include pwd.h
 #include ksh_dir.h
 #include ksh_stat.h
 



CVS commit: src/bin/ksh

2011-08-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 14 10:40:25 UTC 2011

Modified Files:
src/bin/ksh: Makefile eval.c

Log Message:
kill gcc-4.5 hack.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/ksh/Makefile
cvs rdiff -u -r1.12 -r1.13 src/bin/ksh/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/Makefile
diff -u src/bin/ksh/Makefile:1.28 src/bin/ksh/Makefile:1.29
--- src/bin/ksh/Makefile:1.28	Tue Jun 21 22:49:41 2011
+++ src/bin/ksh/Makefile	Sun Aug 14 06:40:25 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2011/06/22 02:49:41 mrg Exp $
+#	$NetBSD: Makefile,v 1.29 2011/08/14 10:40:25 christos Exp $
 
 WARNS=3
 
@@ -50,8 +50,3 @@
 CWARNFLAGS.clang+=	-Wno-format-security
 
 .include bsd.prog.mk
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.eval.c+=	-Wno-error
-.endif

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.12 src/bin/ksh/eval.c:1.13
--- src/bin/ksh/eval.c:1.12	Tue Nov 24 11:00:42 2009
+++ src/bin/ksh/eval.c	Sun Aug 14 06:40:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.12 2009/11/24 16:00:42 seanb Exp $	*/
+/*	$NetBSD: eval.c,v 1.13 2011/08/14 10:40:25 christos Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: eval.c,v 1.12 2009/11/24 16:00:42 seanb Exp $);
+__RCSID($NetBSD: eval.c,v 1.13 2011/08/14 10:40:25 christos Exp $);
 #endif
 
 
@@ -185,6 +185,7 @@
 
 	x.split = 0;	/* XXX gcc */
 	x.str = NULL;	/* XXX gcc */
+	x.u.strv = NULL;/* XXX gcc */
 	if (cp == NULL)
 		internal_errorf(1, expand(NULL));
 	/* for alias, readonly, set, typeset commands */
@@ -714,7 +715,7 @@
 	if (sp[0] == '\0')	/* Bad variable name */
 		return -1;
 
-	xp-var = (struct tbl *) 0;
+	xp-var = NULL;
 
 	/* ${#var}, string length or array size */
 	if (sp[0] == '#'  (c = sp[1]) != '\0') {
@@ -785,10 +786,12 @@
 			return -1;
 		}
 		if (e-loc-argc == 0) {
+			xp-u.strv = NULL;
 			xp-str = null;
 			state = c == '@' ? XNULLSUB : XSUB;
 		} else {
-			xp-u.strv = (const char **) e-loc-argv + 1;
+			char **t = e-loc-argv[1];
+			xp-u.strv = (void *)(uintptr_t)t;
 			xp-str = *xp-u.strv++;
 			xp-split = c == '@'; /* $@ */
 			state = XARG;



CVS commit: src/bin/ksh

2011-06-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jun 22 03:56:17 UTC 2011

Modified Files:
src/bin/ksh: vi.c

Log Message:
add a missing part from rev 1.10 and s/newline/newlinex/.  found by GCC 4.5.3.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/vi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/vi.c
diff -u src/bin/ksh/vi.c:1.11 src/bin/ksh/vi.c:1.12
--- src/bin/ksh/vi.c:1.11	Sat Apr 25 05:11:37 2009
+++ src/bin/ksh/vi.c	Wed Jun 22 03:56:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vi.c,v 1.11 2009/04/25 05:11:37 lukem Exp $	*/
+/*	$NetBSD: vi.c,v 1.12 2011/06/22 03:56:17 mrg Exp $	*/
 
 /*
  *	vi command editing
@@ -9,7 +9,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: vi.c,v 1.11 2009/04/25 05:11:37 lukem Exp $);
+__RCSID($NetBSD: vi.c,v 1.12 2011/06/22 03:56:17 mrg Exp $);
 #endif
 
 #include config.h
@@ -1763,7 +1763,7 @@
 	int newlinex;
 {
 	(void) memset(wbuf[win], ' ', wbuf_len);
-	if (newline) {
+	if (newlinex) {
 		x_putc('\r');
 		x_putc('\n');
 	}



CVS commit: src/bin/ksh

2011-01-23 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Sun Jan 23 17:11:55 UTC 2011

Modified Files:
src/bin/ksh: siglist.sh

Log Message:
The Solaris 7 /usr/{,xpg4/}bin/sorts expect whitespace between the -k
option and its argument.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/bin/ksh/siglist.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/siglist.sh
diff -u src/bin/ksh/siglist.sh:1.8 src/bin/ksh/siglist.sh:1.9
--- src/bin/ksh/siglist.sh:1.8	Sat Oct 25 22:18:15 2008
+++ src/bin/ksh/siglist.sh	Sun Jan 23 17:11:55 2011
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$NetBSD: siglist.sh,v 1.8 2008/10/25 22:18:15 apb Exp $
+#	$NetBSD: siglist.sh,v 1.9 2011/01/23 17:11:55 hauke Exp $
 #
 # Script to generate a sorted, complete list of signals, suitable
 # for inclusion in trap.c as array initializer.
@@ -26,7 +26,7 @@
 	{ QwErTy .signal = SIG\1 , .name = \1, .mess = \2 },\
 #endif/')  $in
 $CPP $in   $out
-${SED} -n 's/{ QwErTy/{/p'  $out | ${AWK} '{print NR, $0}' | sort -k5n -k1n |
+${SED} -n 's/{ QwErTy/{/p'  $out | ${AWK} '{print NR, $0}' | sort -k 5n -k 1n |
 ${SED} 's/^[0-9]* //' |
 ${AWK} 'BEGIN { last=0; nsigs=0; }
 	{



CVS commit: src/bin/ksh

2011-01-23 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Sun Jan 23 17:15:16 UTC 2011

Modified Files:
src/bin/ksh: lex.c

Log Message:
The previous commit removed a { }�block, and unintendedly introduced a
C99ism (inlined variable declaration), which hurts when pdksh is used
for bootstrapping pkgsrc. Move the two declarations to the beginning
of the block.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/lex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/lex.c
diff -u src/bin/ksh/lex.c:1.13 src/bin/ksh/lex.c:1.14
--- src/bin/ksh/lex.c:1.13	Mon Oct 27 19:52:28 2008
+++ src/bin/ksh/lex.c	Sun Jan 23 17:15:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.13 2008/10/27 19:52:28 apb Exp $	*/
+/*	$NetBSD: lex.c,v 1.14 2011/01/23 17:15:15 hauke Exp $	*/
 
 /*
  * lexical analysis and source input
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: lex.c,v 1.13 2008/10/27 19:52:28 apb Exp $);
+__RCSID($NetBSD: lex.c,v 1.14 2011/01/23 17:15:15 hauke Exp $);
 #endif
 
 
@@ -245,6 +245,9 @@
 
 		  Subst:
 			switch (c) {
+			  Lex_state *s;
+			  Lex_state *base;
+
 			  case '\\':
 c = getsc();
 switch (c) {
@@ -341,8 +344,8 @@
  * posix mode was not in effect.
  */
 statep-ls_sbquote.indquotes = 0;
-Lex_state *s = statep;
-Lex_state *base = state_info.base;
+s = statep;
+base = state_info.base;
 while (1) {
 	for (; s != base; s--) {
 		if (s-ls_state == SDQUOTE) {



CVS commit: src/bin/ksh

2010-06-04 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Jun  5 03:02:37 UTC 2010

Modified Files:
src/bin/ksh: edit.c

Log Message:
PR: 39604
Reviewed by:

add_glob:
Do not stop scanning if we see '$' as it does more harm than good.
For $HOME/tm we should return $HOME/tm*


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/ksh/edit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.24 src/bin/ksh/edit.c:1.25
--- src/bin/ksh/edit.c:1.24	Fri Apr  2 20:19:40 2010
+++ src/bin/ksh/edit.c	Sat Jun  5 03:02:37 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.24 2010/04/02 20:19:40 plunky Exp $	*/
+/*	$NetBSD: edit.c,v 1.25 2010/06/05 03:02:37 sjg Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: edit.c,v 1.24 2010/04/02 20:19:40 plunky Exp $);
+__RCSID($NetBSD: edit.c,v 1.25 2010/06/05 03:02:37 sjg Exp $);
 #endif
 
 
@@ -873,14 +873,14 @@
 
 	/*
 	 * If the pathname contains a wildcard (an unquoted '*',
-	 * '?', or '[') or parameter expansion ('$'), or a ~username
+	 * '?', or '['), or a ~username
 	 * with no trailing slash, then it is globbed based on that
 	 * value (i.e., without the appended '*').
 	 */
 	for (s = toglob; *s; s++) {
 		if (*s == '\\'  s[1])
 			s++;
-		else if (*s == '*' || *s == '[' || *s == '?' || *s == '$'
+		else if (*s == '*' || *s == '[' || *s == '?'
 			 || (s[1] == '(' /*)*/  strchr(*...@!, *s)))
 			break;
 		else if (ISDIRSEP(*s))



CVS commit: src/bin/ksh

2010-04-02 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Fri Apr  2 20:19:40 UTC 2010

Modified Files:
src/bin/ksh: edit.c

Log Message:
-   int putbuf_func ARGS((const char *s, size_t len));
+   int (*putbuf_func) ARGS((const char *, size_t));

for pcc
 - did not recognise pointer to function
 - argument names shadowed other arguments


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/bin/ksh/edit.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.23 src/bin/ksh/edit.c:1.24
--- src/bin/ksh/edit.c:1.23	Tue Nov 24 16:00:42 2009
+++ src/bin/ksh/edit.c	Fri Apr  2 20:19:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.23 2009/11/24 16:00:42 seanb Exp $	*/
+/*	$NetBSD: edit.c,v 1.24 2010/04/02 20:19:40 plunky Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: edit.c,v 1.23 2009/11/24 16:00:42 seanb Exp $);
+__RCSID($NetBSD: edit.c,v 1.24 2010/04/02 20:19:40 plunky Exp $);
 #endif
 
 
@@ -1065,7 +1065,7 @@
 x_escape(s, len, putbuf_func)
 	const char *s;
 	size_t len;
-	int putbuf_func ARGS((const char *s, size_t len));
+	int (*putbuf_func) ARGS((const char *, size_t));
 {
 	size_t add, wlen;
 	const char *ifs = str_val(local(IFS, 0));



CVS commit: src/bin/ksh

2009-11-24 Thread Sean Boudreau
Module Name:src
Committed By:   seanb
Date:   Tue Nov 24 16:00:42 UTC 2009

Modified Files:
src/bin/ksh: edit.c eval.c

Log Message:
Back out fix for PR 22846 as it has issues.  See PR 22846 for details.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/ksh/edit.c
cvs rdiff -u -r1.11 -r1.12 src/bin/ksh/eval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/edit.c
diff -u src/bin/ksh/edit.c:1.22 src/bin/ksh/edit.c:1.23
--- src/bin/ksh/edit.c:1.22	Sat Apr 25 05:11:37 2009
+++ src/bin/ksh/edit.c	Tue Nov 24 16:00:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: edit.c,v 1.22 2009/04/25 05:11:37 lukem Exp $	*/
+/*	$NetBSD: edit.c,v 1.23 2009/11/24 16:00:42 seanb Exp $	*/
 
 /*
  * Command line editing - common code
@@ -7,7 +7,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: edit.c,v 1.22 2009/04/25 05:11:37 lukem Exp $);
+__RCSID($NetBSD: edit.c,v 1.23 2009/11/24 16:00:42 seanb Exp $);
 #endif
 
 
@@ -880,7 +880,7 @@
 	for (s = toglob; *s; s++) {
 		if (*s == '\\'  s[1])
 			s++;
-		else if (*s == '*' || *s == '?' || *s == '$'
+		else if (*s == '*' || *s == '[' || *s == '?' || *s == '$'
 			 || (s[1] == '(' /*)*/  strchr(*...@!, *s)))
 			break;
 		else if (ISDIRSEP(*s))

Index: src/bin/ksh/eval.c
diff -u src/bin/ksh/eval.c:1.11 src/bin/ksh/eval.c:1.12
--- src/bin/ksh/eval.c:1.11	Sat Apr 25 05:11:37 2009
+++ src/bin/ksh/eval.c	Tue Nov 24 16:00:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.11 2009/04/25 05:11:37 lukem Exp $	*/
+/*	$NetBSD: eval.c,v 1.12 2009/11/24 16:00:42 seanb Exp $	*/
 
 /*
  * Expansion - quoting, separation, substitution, globbing
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: eval.c,v 1.11 2009/04/25 05:11:37 lukem Exp $);
+__RCSID($NetBSD: eval.c,v 1.12 2009/11/24 16:00:42 seanb Exp $);
 #endif
 
 
@@ -605,21 +605,6 @@
 			if (!quote)
 switch (c) {
   case '[':
-	{
-		const char *p = sp;
-		bool_t special = FALSE;
-		while (*p != EOS) {
-			if (p[0] == CHAR 
-p[1] == ']') {
-special = TRUE;
-break;
-			}
-
-			p += 2;
-		}
-		if (!special)
-			break;
-	}
   case NOT:
   case '-':
   case ']':



CVS commit: src/bin/ksh

2009-10-24 Thread Jeremy C. Reed
Module Name:src
Committed By:   reed
Date:   Sat Oct 24 11:08:47 UTC 2009

Modified Files:
src/bin/ksh: ksh.Man

Log Message:
Show that -l is option for bind builtin.
(The -l is described later.)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/ksh/ksh.Man

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/ksh.Man
diff -u src/bin/ksh/ksh.Man:1.21 src/bin/ksh/ksh.Man:1.22
--- src/bin/ksh/ksh.Man:1.21	Mon Oct 27 19:52:28 2008
+++ src/bin/ksh/ksh.Man	Sat Oct 24 11:08:46 2009
@@ -1,5 +1,5 @@
 '\ t
-.\ $NetBSD: ksh.Man,v 1.21 2008/10/27 19:52:28 apb Exp $
+.\ $NetBSD: ksh.Man,v 1.22 2009/10/24 11:08:46 reed Exp $
 .\{{{}}}
 .\{{{  Notes about man page
 .\ - use the pseudo-macros .sh( and .sh) to begin and end sh-specific
@@ -1716,7 +1716,7 @@
 See Job Control below for more information.
 .\}}}
 .\{{{  bind [-l] [-m] [key[=editing-command] ...]
-.IP \fBbind\fP [\fB\-m\fP] [\fIkey\fP[\fB=\fP\fIediting-command\fP] ...]
+.IP \fBbind\fP [\fB\-l\fP] [\fB\-m\fP] [\fIkey\fP[\fB=\fP\fIediting-command\fP] ...]
 Set or view the current emacs command editing key bindings/macros.
 See Emacs Editing Mode below for a complete description.
 .\}}}



CVS commit: src/bin/ksh

2009-10-22 Thread Sean Boudreau
Module Name:src
Committed By:   seanb
Date:   Thu Oct 22 15:53:19 UTC 2009

Modified Files:
src/bin/ksh: misc.c

Log Message:
Wrong buffer len being passed to strlcpy().  Innocuous
here but...


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/ksh/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/ksh/misc.c
diff -u src/bin/ksh/misc.c:1.13 src/bin/ksh/misc.c:1.14
--- src/bin/ksh/misc.c:1.13	Sat Apr 25 05:11:37 2009
+++ src/bin/ksh/misc.c	Thu Oct 22 15:53:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.13 2009/04/25 05:11:37 lukem Exp $	*/
+/*	$NetBSD: misc.c,v 1.14 2009/10/22 15:53:19 seanb Exp $	*/
 
 /*
  * Miscellaneous functions
@@ -6,7 +6,7 @@
 #include sys/cdefs.h
 
 #ifndef lint
-__RCSID($NetBSD: misc.c,v 1.13 2009/04/25 05:11:37 lukem Exp $);
+__RCSID($NetBSD: misc.c,v 1.14 2009/10/22 15:53:19 seanb Exp $);
 #endif
 
 
@@ -96,7 +96,7 @@
 		return NULL;
 	len = strlen(s)+1;
 	p = alloc(len, ap);
-	strlcpy(p, s, len+1);
+	strlcpy(p, s, len);
 	return (p);
 }