CVS commit: src/bin/csh

2024-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 24 15:49:03 UTC 2024

Modified Files:
src/bin/csh: dir.c file.c func.c glob.c misc.c str.c

Log Message:
csh: replace malloc(x * y) and realloc(x * y) with reallocarray


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/dir.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/file.c
cvs rdiff -u -r1.44 -r1.45 src/bin/csh/func.c
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/glob.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/misc.c
cvs rdiff -u -r1.16 -r1.17 src/bin/csh/str.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/csh/dir.c
diff -u src/bin/csh/dir.c:1.35 src/bin/csh/dir.c:1.36
--- src/bin/csh/dir.c:1.35	Sun Aug  9 00:34:21 2020
+++ src/bin/csh/dir.c	Wed Apr 24 15:49:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.35 2020/08/09 00:34:21 dholland Exp $ */
+/* $NetBSD: dir.c,v 1.36 2024/04/24 15:49:03 nia Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.35 2020/08/09 00:34:21 dholland Exp $");
+__RCSID("$NetBSD: dir.c,v 1.36 2024/04/24 15:49:03 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -279,8 +279,8 @@ dnormalize(Char *cp)
 	size_t  dotdot = 0;
 	Char   *dp, *cwd;
 
-	cwd = xmalloc((size_t)((Strlen(dcwd->di_name) + 3) *
-	sizeof(Char)));
+	cwd = xreallocarray(NULL, (size_t)(Strlen(dcwd->di_name) + 3),
+	sizeof(Char));
 	(void)Strcpy(cwd, dcwd->di_name);
 
 	/*
@@ -389,7 +389,8 @@ dgoto(Char *cp)
 	cwdlen = 0;
 	for (p = cp; *p++;)
 	continue;
-	dp = xmalloc((size_t)(cwdlen + (size_t)(p - cp) + 1) * sizeof(Char));
+	dp = xreallocarray(NULL,
+	(size_t)(cwdlen + (size_t)(p - cp) + 1), sizeof(Char));
 	for (p = dp, q = dcwd->di_name; (*p++ = *q++) != '\0';)
 	continue;
 	if (cwdlen)
@@ -705,8 +706,8 @@ dcanon(Char *cp, Char *p)
 		/*
 		 * New length is "yyy/" + slink + "/.." and rest
 		 */
-		p1 = newcp = xmalloc(
-		(size_t)((sp - cp) + cc + (p1 - p)) * sizeof(Char));
+		p1 = newcp = xreallocarray(NULL,
+		(size_t)((sp - cp) + cc + (p1 - p)), sizeof(Char));
 		/*
 		 * Copy new path into newcp
 		 */
@@ -725,8 +726,8 @@ dcanon(Char *cp, Char *p)
 		/*
 		 * New length is slink + "/.." and rest
 		 */
-		p1 = newcp = xmalloc(
-		(size_t)(cc + (p1 - p)) * sizeof(Char));
+		p1 = newcp = xreallocarray(NULL,
+		(size_t)(cc + (p1 - p)), sizeof(Char));
 		/*
 		 * Copy new path into newcp
 		 */
@@ -794,8 +795,8 @@ dcanon(Char *cp, Char *p)
 		/*
 		 * New length is "yyy/" + slink + "/.." and rest
 		 */
-		p1 = newcp = xmalloc(
-		(size_t)((sp - cp) + cc + (p1 - p)) * sizeof(Char));
+		p1 = newcp = xreallocarray(NULL,
+		(size_t)((sp - cp) + cc + (p1 - p)), sizeof(Char));
 		/*
 		 * Copy new path into newcp
 		 */
@@ -814,8 +815,8 @@ dcanon(Char *cp, Char *p)
 		/*
 		 * New length is slink + the rest
 		 */
-		p1 = newcp = xmalloc(
-		(size_t)(cc + (p1 - p)) * sizeof(Char));
+		p1 = newcp = xreallocarray(NULL,
+		(size_t)(cc + (p1 - p)), sizeof(Char));
 		/*
 		 * Copy new path into newcp
 		 */

Index: src/bin/csh/file.c
diff -u src/bin/csh/file.c:1.33 src/bin/csh/file.c:1.34
--- src/bin/csh/file.c:1.33	Tue Sep 29 02:58:51 2020
+++ src/bin/csh/file.c	Wed Apr 24 15:49:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: file.c,v 1.33 2020/09/29 02:58:51 msaitoh Exp $ */
+/* $NetBSD: file.c,v 1.34 2024/04/24 15:49:03 nia Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)file.c	8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: file.c,v 1.33 2020/09/29 02:58:51 msaitoh Exp $");
+__RCSID("$NetBSD: file.c,v 1.34 2024/04/24 15:49:03 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -519,13 +519,10 @@ again:/* search for matches */
 	if (command == LIST) {
 	if ((size_t)numitems >= maxitems) {
 		maxitems += 1024;
-		if (items == NULL)
-			items = xmalloc(sizeof(*items) * maxitems);
-		else
-			items = xrealloc(items, sizeof(*items) * maxitems);
+		items = xreallocarray(items, sizeof(*items), maxitems);
  	}
-	items[numitems] = xmalloc((size_t) (Strlen(entry) + 1) *
-	sizeof(Char));
+	items[numitems] = xreallocarray(NULL,
+		(size_t) (Strlen(entry) + 1), sizeof(Char));
 	copyn(items[numitems], entry, MAXNAMLEN);
 	numitems++;
 	}

Index: src/bin/csh/func.c
diff -u src/bin/csh/func.c:1.44 src/bin/csh/func.c:1.45
--- src/bin/csh/func.c:1.44	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/func.c	Wed Apr 24 15:49:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: func.c,v 1.45 2024/04/24 15:49:03 nia Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char 

CVS commit: src/bin/csh

2024-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 24 15:49:03 UTC 2024

Modified Files:
src/bin/csh: dir.c file.c func.c glob.c misc.c str.c

Log Message:
csh: replace malloc(x * y) and realloc(x * y) with reallocarray


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/dir.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/file.c
cvs rdiff -u -r1.44 -r1.45 src/bin/csh/func.c
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/glob.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/misc.c
cvs rdiff -u -r1.16 -r1.17 src/bin/csh/str.c

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



CVS commit: src/bin/csh

2024-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 24 15:47:12 UTC 2024

Modified Files:
src/bin/csh: csh.h

Log Message:
csh: add a helper definition for the reallocarray function


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/csh.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/csh/csh.h
diff -u src/bin/csh/csh.h:1.29 src/bin/csh/csh.h:1.30
--- src/bin/csh/csh.h:1.29	Fri Apr  3 18:11:29 2020
+++ src/bin/csh/csh.h	Wed Apr 24 15:47:11 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.29 2020/04/03 18:11:29 joerg Exp $ */
+/* $NetBSD: csh.h,v 1.30 2024/04/24 15:47:11 nia Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -86,6 +86,7 @@ typedef void *ioctl_t;		/* Third arg of 
 
 #define xmalloc(i) Malloc(i)
 #define xrealloc(p, i) Realloc(p, i)
+#define xreallocarray(p, n, sz) Reallocarray(p, n, sz)
 #define xcalloc(n, s) Calloc(n, s)
 
 #include 



CVS commit: src/bin/csh

2024-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 24 15:47:12 UTC 2024

Modified Files:
src/bin/csh: csh.h

Log Message:
csh: add a helper definition for the reallocarray function


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/csh.h

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



CVS commit: src/bin/csh

2024-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 24 15:46:20 UTC 2024

Modified Files:
src/bin/csh: alloc.c extern.h

Log Message:
csh: add a reallocarray function for using inside csh


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/csh/alloc.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/extern.h

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



CVS commit: src/bin/csh

2024-04-24 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 24 15:46:20 UTC 2024

Modified Files:
src/bin/csh: alloc.c extern.h

Log Message:
csh: add a reallocarray function for using inside csh


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/csh/alloc.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/extern.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/csh/alloc.c
diff -u src/bin/csh/alloc.c:1.15 src/bin/csh/alloc.c:1.16
--- src/bin/csh/alloc.c:1.15	Sat Jan  5 16:54:00 2019
+++ src/bin/csh/alloc.c	Wed Apr 24 15:46:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.15 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: alloc.c,v 1.16 2024/04/24 15:46:20 nia Exp $ */
 
 /*-
  * Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)alloc.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: alloc.c,v 1.15 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.16 2024/04/24 15:46:20 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,6 +72,19 @@ Realloc(void *p, size_t n)
 }
 
 void *
+Reallocarray(void *p, size_t n, size_t sz)
+{
+void *ptr = p;
+
+if (reallocarr(, n, sz) != 0) {
+	child++;
+	stderror(ERR_NOMEM);
+	return (p);
+}
+return (ptr);
+}
+
+void *
 Calloc(size_t s, size_t n)
 {
 void *ptr;

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.34 src/bin/csh/extern.h:1.35
--- src/bin/csh/extern.h:1.34	Thu Sep 15 11:35:06 2022
+++ src/bin/csh/extern.h	Wed Apr 24 15:46:20 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.34 2022/09/15 11:35:06 martin Exp $ */
+/* $NetBSD: extern.h,v 1.35 2024/04/24 15:46:20 nia Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -314,6 +314,7 @@ void psecs(long);
 void Free(void *);
 void * Malloc(size_t);
 void *Realloc(void *, size_t);
+void *Reallocarray(void *, size_t, size_t);
 void *Calloc(size_t, size_t);
 
 /*



CVS commit: src/bin/csh

2022-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 15 11:35:06 UTC 2022

Modified Files:
src/bin/csh: csh.c extern.h set.c

Log Message:
Fix the build for variants that do not define EDIT.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/csh/csh.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/extern.h
cvs rdiff -u -r1.39 -r1.40 src/bin/csh/set.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.55 src/bin/csh/csh.c:1.56
--- src/bin/csh/csh.c:1.55	Wed Sep 14 17:06:16 2022
+++ src/bin/csh/csh.c	Thu Sep 15 11:35:06 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.55 2022/09/14 17:06:16 christos Exp $ */
+/* $NetBSD: csh.c,v 1.56 2022/09/15 11:35:06 martin Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.55 2022/09/14 17:06:16 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.56 2022/09/15 11:35:06 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -1139,7 +1139,9 @@ process(int catch)
 	pnote();
 	if (intty && prompt && evalvec == 0) {
 	mailchk();
+#ifdef EDIT
 	updateediting();
+#endif
 	/*
 	 * If we are at the end of the input buffer then we are going to
 	 * read fresh stuff. Otherwise, we are rereading input and don't

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.33 src/bin/csh/extern.h:1.34
--- src/bin/csh/extern.h:1.33	Wed Sep 14 16:15:51 2022
+++ src/bin/csh/extern.h	Thu Sep 15 11:35:06 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.33 2022/09/14 16:15:51 christos Exp $ */
+/* $NetBSD: extern.h,v 1.34 2022/09/15 11:35:06 martin Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -291,7 +291,9 @@ void unsetv(Char *);
 void setNS(Char *);
 void shift(Char **, struct command *);
 void plist(struct varent *);
+#ifdef EDIT
 void updateediting(void);
+#endif
 
 /*
  * time.c

Index: src/bin/csh/set.c
diff -u src/bin/csh/set.c:1.39 src/bin/csh/set.c:1.40
--- src/bin/csh/set.c:1.39	Wed Sep 14 16:15:51 2022
+++ src/bin/csh/set.c	Thu Sep 15 11:35:06 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.39 2022/09/14 16:15:51 christos Exp $ */
+/* $NetBSD: set.c,v 1.40 2022/09/15 11:35:06 martin Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: set.c,v 1.39 2022/09/14 16:15:51 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.40 2022/09/15 11:35:06 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -59,9 +59,9 @@ static void unsetv1(struct varent *);
 static void exportpath(Char **);
 static void balance(struct varent *, int, int);
 
+#ifdef EDIT
 static int wantediting;
 
-#ifdef EDIT
 static const char *
 alias_text(void *dummy __unused, const char *name)
 {
@@ -555,6 +555,7 @@ unset(Char **v, struct command *t)
 #endif
 }
 
+#ifdef EDIT
 extern int insource;
 void
 updateediting(void)
@@ -590,6 +591,7 @@ updateediting(void)
 }
 editing = wantediting;
 }
+#endif
 
 void
 unset1(Char *v[], struct varent *head)



CVS commit: src/bin/csh

2022-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 15 11:35:06 UTC 2022

Modified Files:
src/bin/csh: csh.c extern.h set.c

Log Message:
Fix the build for variants that do not define EDIT.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/csh/csh.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/extern.h
cvs rdiff -u -r1.39 -r1.40 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2022-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 17:06:16 UTC 2022

Modified Files:
src/bin/csh: csh.c

Log Message:
Update editing before prompt printing.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/csh/csh.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.54 src/bin/csh/csh.c:1.55
--- src/bin/csh/csh.c:1.54	Wed Sep 14 12:15:51 2022
+++ src/bin/csh/csh.c	Wed Sep 14 13:06:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.54 2022/09/14 16:15:51 christos Exp $ */
+/* $NetBSD: csh.c,v 1.55 2022/09/14 17:06:16 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.54 2022/09/14 16:15:51 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.55 2022/09/14 17:06:16 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1139,6 +1139,7 @@ process(int catch)
 	pnote();
 	if (intty && prompt && evalvec == 0) {
 	mailchk();
+	updateediting();
 	/*
 	 * If we are at the end of the input buffer then we are going to
 	 * read fresh stuff. Otherwise, we are rereading input and don't
@@ -1153,7 +1154,6 @@ process(int catch)
 	seterr = NULL;
 	}
 
-	updateediting();
 
 	/*
 	 * Echo not only on VERBOSE, but also with history expansion. If there



CVS commit: src/bin/csh

2022-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 17:06:16 UTC 2022

Modified Files:
src/bin/csh: csh.c

Log Message:
Update editing before prompt printing.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/bin/csh/csh.c

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



CVS commit: src/bin/csh

2022-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:15:52 UTC 2022

Modified Files:
src/bin/csh: csh.c extern.h set.c

Log Message:
defer editing setup/cleanup to when we are interactive.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/bin/csh/csh.c
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/extern.h
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2022-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 14 16:15:52 UTC 2022

Modified Files:
src/bin/csh: csh.c extern.h set.c

Log Message:
defer editing setup/cleanup to when we are interactive.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/bin/csh/csh.c
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/extern.h
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/set.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.53 src/bin/csh/csh.c:1.54
--- src/bin/csh/csh.c:1.53	Sat Aug  8 20:53:38 2020
+++ src/bin/csh/csh.c	Wed Sep 14 12:15:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $ */
+/* $NetBSD: csh.c,v 1.54 2022/09/14 16:15:51 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $");
+__RCSID("$NetBSD: csh.c,v 1.54 2022/09/14 16:15:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1153,6 +1153,8 @@ process(int catch)
 	seterr = NULL;
 	}
 
+	updateediting();
+
 	/*
 	 * Echo not only on VERBOSE, but also with history expansion. If there
 	 * is a lexical error then we forego history echo.

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.32 src/bin/csh/extern.h:1.33
--- src/bin/csh/extern.h:1.32	Thu Apr 23 03:54:53 2020
+++ src/bin/csh/extern.h	Wed Sep 14 12:15:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.32 2020/04/23 07:54:53 simonb Exp $ */
+/* $NetBSD: extern.h,v 1.33 2022/09/14 16:15:51 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -291,6 +291,7 @@ void unsetv(Char *);
 void setNS(Char *);
 void shift(Char **, struct command *);
 void plist(struct varent *);
+void updateediting(void);
 
 /*
  * time.c

Index: src/bin/csh/set.c
diff -u src/bin/csh/set.c:1.38 src/bin/csh/set.c:1.39
--- src/bin/csh/set.c:1.38	Sun Aug 15 08:16:02 2021
+++ src/bin/csh/set.c	Wed Sep 14 12:15:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.38 2021/08/15 12:16:02 christos Exp $ */
+/* $NetBSD: set.c,v 1.39 2022/09/14 16:15:51 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: set.c,v 1.38 2021/08/15 12:16:02 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.39 2022/09/14 16:15:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -59,6 +59,8 @@ static void unsetv1(struct varent *);
 static void exportpath(Char **);
 static void balance(struct varent *, int, int);
 
+static int wantediting;
+
 #ifdef EDIT
 static const char *
 alias_text(void *dummy __unused, const char *name)
@@ -148,26 +150,8 @@ update_vars(Char *vp)
 	filec = 1;
 #endif
 #ifdef EDIT
-else if (eq(vp, STRedit)) {
-	HistEvent ev;
-	Char *vn = value(STRhistchars);
-
-	editing = 1;
-	el = el_init_fd(getprogname(), cshin, cshout, csherr,
-	SHIN, SHOUT, SHERR);
-	el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs");
-	el_set(el, EL_PROMPT, printpromptstr);
-	el_set(el, EL_ALIAS_TEXT, alias_text, NULL);
-	el_set(el, EL_SAFEREAD, 1);
-	el_set(el, EL_ADDFN, "rl-complete",
-	"ReadLine compatible completion function", _el_fn_complete);
-	el_set(el, EL_BIND, "^I", adrof(STRfilec) ? "rl-complete" : "ed-insert",
-	NULL);
-	hi = history_init();
-	history(hi, , H_SETSIZE, getn(value(STRhistory)));
-	loadhist(Histlist.Hnext);
-	el_set(el, EL_HIST, history, hi);
-}
+else if (eq(vp, STRedit))
+	wantediting = 1;
 #endif
 }
 
@@ -566,16 +550,45 @@ unset(Char **v, struct command *t)
 	filec = 0;
 #endif
 #ifdef EDIT
-if (adrof(STRedit) == 0) {
+if (adrof(STRedit) == 0)
+	wantediting = 0;
+#endif
+}
+
+extern int insource;
+void
+updateediting(void)
+{
+if (insource || wantediting == editing)
+	return;
+
+if (wantediting) {
+	HistEvent ev;
+	Char *vn = value(STRhistchars);
+
+	el = el_init_fd(getprogname(), cshin, cshout, csherr,
+	SHIN, SHOUT, SHERR);
+	el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs");
+	el_set(el, EL_PROMPT, printpromptstr);
+	el_set(el, EL_ALIAS_TEXT, alias_text, NULL);
+	el_set(el, EL_SAFEREAD, 1);
+	el_set(el, EL_ADDFN, "rl-complete",
+	"ReadLine compatible completion function", _el_fn_complete);
+	el_set(el, EL_BIND, "^I", adrof(STRfilec) ? "rl-complete" : "ed-insert",
+	NULL);
+	hi = history_init();
+	history(hi, , H_SETSIZE, getn(value(STRhistory)));
+	loadhist(Histlist.Hnext);
+	el_set(el, EL_HIST, history, hi);
+} else {
 	if (el)
 	el_end(el);
 	if (hi)
 	history_end(hi);
 	el = NULL;
 	hi = NULL;
-	editing = 0;
 }
-#endif
+editing = wantediting;
 }
 
 void



CVS commit: src/bin/csh

2022-07-09 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jul  9 21:19:44 UTC 2022

Modified Files:
src/bin/csh: csh.1

Log Message:
csh(1): fix punctuation at the end of an .Xr line


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/csh/csh.1

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

Modified files:

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.55 src/bin/csh/csh.1:1.56
--- src/bin/csh/csh.1:1.55	Sat Sep 11 20:55:03 2021
+++ src/bin/csh/csh.1	Sat Jul  9 21:19:44 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: csh.1,v 1.55 2021/09/11 20:55:03 christos Exp $
+.\"	$NetBSD: csh.1,v 1.56 2022/07/09 21:19:44 uwe Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -1343,7 +1343,7 @@ option lists process id's in addition to
 The
 .Fl Z
 option sets the process title using
-.Xr setproctitle 3.
+.Xr setproctitle 3 .
 .Pp
 .It Ic kill % Ns Ar job
 .It Ic kill Ar pid ...



CVS commit: src/bin/csh

2022-07-09 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Jul  9 21:19:44 UTC 2022

Modified Files:
src/bin/csh: csh.1

Log Message:
csh(1): fix punctuation at the end of an .Xr line


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/bin/csh/csh.1

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



CVS commit: src/bin/csh/USD.doc

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 21:02:49 UTC 2021

Modified Files:
src/bin/csh/USD.doc: csh.2

Log Message:
s/backgound/background/


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/csh/USD.doc/csh.2

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



CVS commit: src/bin/csh/USD.doc

2021-12-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Dec 19 21:02:49 UTC 2021

Modified Files:
src/bin/csh/USD.doc: csh.2

Log Message:
s/backgound/background/


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/bin/csh/USD.doc/csh.2

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

Modified files:

Index: src/bin/csh/USD.doc/csh.2
diff -u src/bin/csh/USD.doc/csh.2:1.7 src/bin/csh/USD.doc/csh.2:1.8
--- src/bin/csh/USD.doc/csh.2:1.7	Thu Aug  7 09:05:08 2003
+++ src/bin/csh/USD.doc/csh.2	Sun Dec 19 21:02:49 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: csh.2,v 1.7 2003/08/07 09:05:08 agc Exp $
+.\"	$NetBSD: csh.2,v 1.8 2021/12/19 21:02:49 andvar Exp $
 .\"
 .\" Copyright (c) 1980, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -673,7 +673,7 @@ which can be used later to refer to the 
 Job numbers remain
 the same until the job terminates and then are re-used.
 .PP
-When a job is started in the backgound using `&', its number, as well
+When a job is started in the background using `&', its number, as well
 as the process numbers of all its (top level) commands, is typed by the shell
 before prompting you for another command. For example,
 .DS
@@ -698,7 +698,7 @@ foreground job.  A background job can be
 .I stop
 command described below.  When jobs are suspended they merely stop
 any further progress until started again, either in the foreground
-or the backgound.  The shell notices when a job becomes stopped and
+or the background.  The shell notices when a job becomes stopped and
 reports this fact, much like it reports the termination of background jobs.
 For foreground jobs this looks like
 .DS
@@ -741,7 +741,7 @@ starts `du' in the foreground, stops it 
 it in the background allowing more foreground commands to be executed.
 This is especially helpful
 when a foreground job ends up taking longer than you expected and you
-wish you had started it in the backgound in the beginning.
+wish you had started it in the background in the beginning.
 .PP
 All
 .I "job control"
@@ -774,7 +774,7 @@ in only one of the jobs.
 The
 .I jobs
 command types the table of jobs, giving the job number,
-commands and status (`Stopped' or `Running') of each backgound or
+commands and status (`Stopped' or `Running') of each background or
 suspended job.  With the `\-l' option the process numbers are also
 typed.
 .DS
@@ -873,7 +873,7 @@ and then put in the background using
 Some time later when the `s' command was finished,
 .I ed
 tried to read another command and was stopped because jobs
-in the backgound cannot read from the terminal.  The
+in the background cannot read from the terminal.  The
 .I fg
 command returned the `ed' job to the foreground where it could once again
 accept commands from the terminal.



CVS commit: src/bin/csh

2021-09-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 16 19:34:21 UTC 2021

Modified Files:
src/bin/csh: proc.c

Log Message:
provide a way to reset setproctitle.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/csh/proc.c

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



CVS commit: src/bin/csh

2021-09-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 16 19:34:21 UTC 2021

Modified Files:
src/bin/csh: proc.c

Log Message:
provide a way to reset setproctitle.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/csh/proc.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/csh/proc.c
diff -u src/bin/csh/proc.c:1.41 src/bin/csh/proc.c:1.42
--- src/bin/csh/proc.c:1.41	Sat Sep 11 16:55:03 2021
+++ src/bin/csh/proc.c	Thu Sep 16 15:34:21 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.c,v 1.41 2021/09/11 20:55:03 christos Exp $ */
+/* $NetBSD: proc.c,v 1.42 2021/09/16 19:34:21 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)proc.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: proc.c,v 1.41 2021/09/11 20:55:03 christos Exp $");
+__RCSID("$NetBSD: proc.c,v 1.42 2021/09/16 19:34:21 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -845,8 +845,12 @@ dojobs(Char **v, struct command *t)
 	if (v[1]) {
 	if (eq(*v, STRml)) {
 		flag |= FANCY | JOBDIR;
-	} else if (eq(*v, STRmZ) && v[1]) {
-		setproctitle("%s", short2str(v[1]));
+	} else if (eq(*v, STRmZ)) {
+		if (v[1] && v[1][0]) {
+		setproctitle("%s", short2str(v[1]));
+		} else {
+		setproctitle(NULL);
+		}
 		return;
 	} else {
 		stderror(ERR_JOBS);



CVS commit: src/bin/csh

2021-09-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 11 20:55:03 UTC 2021

Modified Files:
src/bin/csh: const.c csh.1 err.c init.c proc.c

Log Message:
like zsh, have jobs -Z do setproctitle


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/csh/const.c
cvs rdiff -u -r1.54 -r1.55 src/bin/csh/csh.1
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/err.c
cvs rdiff -u -r1.11 -r1.12 src/bin/csh/init.c
cvs rdiff -u -r1.40 -r1.41 src/bin/csh/proc.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/csh/const.c
diff -u src/bin/csh/const.c:1.10 src/bin/csh/const.c:1.11
--- src/bin/csh/const.c:1.10	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/const.c	Sat Sep 11 16:55:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: const.c,v 1.10 2013/01/22 20:35:29 christos Exp $ */
+/* $NetBSD: const.c,v 1.11 2021/09/11 20:55:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)const.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: const.c,v 1.10 2013/01/22 20:35:29 christos Exp $");
+__RCSID("$NetBSD: const.c,v 1.11 2021/09/11 20:55:03 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -108,6 +108,7 @@ Char STRmail[]		= { 'm', 'a', 'i', 'l', 
 Char STRmh[]= { '-', 'h', '\0' };
 Char STRminus[]		= { '-', '\0' };
 Char STRml[]		= { '-', 'l', '\0' };
+Char STRmZ[]		= { '-', 'Z', '\0' };
 Char STRmn[]		= { '-', 'n', '\0' };
 Char STRmquestion[] = { '?' | QUOTE, ' ', '\0' };
 Char STRnice[]		= { 'n', 'i', 'c', 'e', '\0' };

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.54 src/bin/csh/csh.1:1.55
--- src/bin/csh/csh.1:1.54	Mon Jul  3 17:33:22 2017
+++ src/bin/csh/csh.1	Sat Sep 11 16:55:03 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: csh.1,v 1.54 2017/07/03 21:33:22 wiz Exp $
+.\"	$NetBSD: csh.1,v 1.55 2021/09/11 20:55:03 christos Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)csh.1	8.2 (Berkeley) 1/21/94
 .\"
-.Dd August 8, 2016
+.Dd September 11, 2021
 .Dt CSH 1
 .Os
 .Sh NAME
@@ -1336,10 +1336,14 @@ must appear alone on its input line or a
 .Ic else . )
 .Pp
 .It Ic jobs
-.It Ic jobs Fl l
+.It Ic jobs Fl lZ
 Lists the active jobs; the
 .Fl l
 option lists process id's in addition to the normal information.
+The
+.Fl Z
+option sets the process title using
+.Xr setproctitle 3.
 .Pp
 .It Ic kill % Ns Ar job
 .It Ic kill Ar pid ...

Index: src/bin/csh/err.c
diff -u src/bin/csh/err.c:1.23 src/bin/csh/err.c:1.24
--- src/bin/csh/err.c:1.23	Sat Jan  5 11:54:00 2019
+++ src/bin/csh/err.c	Sat Sep 11 16:55:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: err.c,v 1.23 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: err.c,v 1.24 2021/09/11 20:55:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)err.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: err.c,v 1.23 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: err.c,v 1.24 2021/09/11 20:55:03 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -171,7 +171,7 @@ static const char *errorlist[] =
 #define ERR_STRING	56
 "%s",
 #define ERR_JOBS	57
-"usage: jobs [ -l ]",
+"usage: jobs [ -lZ ]",
 #define ERR_JOBARGS	58
 "Arguments should be jobs or process id's",
 #define ERR_JOBCUR	59

Index: src/bin/csh/init.c
diff -u src/bin/csh/init.c:1.11 src/bin/csh/init.c:1.12
--- src/bin/csh/init.c:1.11	Tue Jan 22 14:28:00 2013
+++ src/bin/csh/init.c	Sat Sep 11 16:55:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $ */
+/* $NetBSD: init.c,v 1.12 2021/09/11 20:55:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)init.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $");
+__RCSID("$NetBSD: init.c,v 1.12 2021/09/11 20:55:03 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -73,7 +73,7 @@ struct biltins bfunc[] =
 { "hashstat", 	hashstat, 	0, 0	},
 { "history", 	dohist, 	0, 2	},
 { "if", 		doif, 		1, INF	},
-{ "jobs", 		dojobs, 	0, 1	},
+{ "jobs", 		dojobs, 	0, 2	},
 { "kill", 		dokill, 	1, INF	},
 { "limit", 		dolimit, 	0, 3	},
 { "linedit", 	doecho, 	0, INF	},

Index: src/bin/csh/proc.c
diff -u src/bin/csh/proc.c:1.40 src/bin/csh/proc.c:1.41
--- src/bin/csh/proc.c:1.40	Sat Aug  8 20:22:53 2020
+++ src/bin/csh/proc.c	Sat Sep 11 16:55:03 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.c,v 1.40 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: proc.c,v 1.41 2021/09/11 20:55:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)proc.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: proc.c,v 1.40 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: proc.c,v 1.41 2021/09/11 20:55:03 christos Exp $");

CVS commit: src/bin/csh

2021-09-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 11 20:55:03 UTC 2021

Modified Files:
src/bin/csh: const.c csh.1 err.c init.c proc.c

Log Message:
like zsh, have jobs -Z do setproctitle


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/bin/csh/const.c
cvs rdiff -u -r1.54 -r1.55 src/bin/csh/csh.1
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/err.c
cvs rdiff -u -r1.11 -r1.12 src/bin/csh/init.c
cvs rdiff -u -r1.40 -r1.41 src/bin/csh/proc.c

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



CVS commit: src/bin/csh

2021-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 15 12:16:02 UTC 2021

Modified Files:
src/bin/csh: set.c

Log Message:
Turn on EL_SAFEREAD


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/set.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/csh/set.c
diff -u src/bin/csh/set.c:1.37 src/bin/csh/set.c:1.38
--- src/bin/csh/set.c:1.37	Sun Jan 12 13:42:41 2020
+++ src/bin/csh/set.c	Sun Aug 15 08:16:02 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.37 2020/01/12 18:42:41 christos Exp $ */
+/* $NetBSD: set.c,v 1.38 2021/08/15 12:16:02 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: set.c,v 1.37 2020/01/12 18:42:41 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.38 2021/08/15 12:16:02 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -158,6 +158,7 @@ update_vars(Char *vp)
 	el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs");
 	el_set(el, EL_PROMPT, printpromptstr);
 	el_set(el, EL_ALIAS_TEXT, alias_text, NULL);
+	el_set(el, EL_SAFEREAD, 1);
 	el_set(el, EL_ADDFN, "rl-complete",
 	"ReadLine compatible completion function", _el_fn_complete);
 	el_set(el, EL_BIND, "^I", adrof(STRfilec) ? "rl-complete" : "ed-insert",



CVS commit: src/bin/csh

2021-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 15 12:16:02 UTC 2021

Modified Files:
src/bin/csh: set.c

Log Message:
Turn on EL_SAFEREAD


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2020-10-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Oct 17 08:46:02 UTC 2020

Modified Files:
src/bin/csh: time.c

Log Message:
Print real maxrss value like other shells.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/time.c

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



CVS commit: src/bin/csh

2020-10-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Oct 17 08:46:02 UTC 2020

Modified Files:
src/bin/csh: time.c

Log Message:
Print real maxrss value like other shells.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/time.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/csh/time.c
diff -u src/bin/csh/time.c:1.22 src/bin/csh/time.c:1.23
--- src/bin/csh/time.c:1.22	Thu Apr 23 07:54:53 2020
+++ src/bin/csh/time.c	Sat Oct 17 08:46:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: time.c,v 1.22 2020/04/23 07:54:53 simonb Exp $ */
+/* $NetBSD: time.c,v 1.23 2020/10/17 08:46:02 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: time.c,v 1.22 2020/04/23 07:54:53 simonb Exp $");
+__RCSID("$NetBSD: time.c,v 1.23 2020/10/17 08:46:02 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -182,7 +182,7 @@ prusage1(FILE *fp, const char *cp, int p
 			 (r0->ru_ixrss + r0->ru_idrss + r0->ru_isrss)) / t));
 		break;
 	case 'M':		/* max. Resident Set Size */
-		(void)fprintf(fp, "%ld", r1->ru_maxrss / 2L);
+		(void)fprintf(fp, "%ld", r1->ru_maxrss);
 		break;
 	case 'O':		/* FS blocks out */
 		(void)fprintf(fp, "%ld", r1->ru_oublock - r0->ru_oublock);



CVS commit: src/bin/csh

2020-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 17:33:14 UTC 2020

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

Log Message:
undo previous for 'r' and 'e' modifiers; they should no go further than
the last '/'.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/lex.c

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



CVS commit: src/bin/csh

2020-10-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  2 17:33:14 UTC 2020

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

Log Message:
undo previous for 'r' and 'e' modifiers; they should no go further than
the last '/'.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/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/csh/lex.c
diff -u src/bin/csh/lex.c:1.37 src/bin/csh/lex.c:1.38
--- src/bin/csh/lex.c:1.37	Wed Sep 30 13:51:10 2020
+++ src/bin/csh/lex.c	Fri Oct  2 13:33:13 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.37 2020/09/30 17:51:10 christos Exp $ */
+/* $NetBSD: lex.c,v 1.38 2020/10/02 17:33:13 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.37 2020/09/30 17:51:10 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.38 2020/10/02 17:33:13 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -996,6 +996,7 @@ domod(Char *cp, int type)
 	if ((c != ' ' && c != '\t') || type == 'q')
 		*xp |= QUOTE;
 	return (wp);
+
 case 'h':
 case 't':
 	wp = Strrchr(cp, '/');
@@ -1009,14 +1010,16 @@ domod(Char *cp, int type)
 
 case 'e':
 case 'r':
-	wp = Strrchr(cp, '.');
-	if (wp == NULL)
-	return Strsave(type == 'r' ? cp : STRNULL);
-	if (type == 'e')
-	xp = Strsave(wp + 1);
-	else
-	xp = Strsave(cp), xp[wp - cp] = 0;
-	return (xp);
+	wp = Strend(cp);
+	for (wp--; wp >= cp && *wp != '/'; wp--)
+	if (*wp == '.') {
+		if (type == 'e')
+		xp = Strsave(wp + 1);
+		else
+		xp = Strsave(cp), xp[wp - cp] = 0;
+		return (xp);
+	}
+	return (Strsave(type == 'e' ? STRNULL : cp));
 
 default:
 	break;



CVS commit: src/bin/csh

2020-09-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 30 17:51:10 UTC 2020

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

Log Message:
Fix
% set x='a/b c/d.e'
% echo $x:q:h


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/lex.c

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



CVS commit: src/bin/csh

2020-09-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 30 17:51:10 UTC 2020

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

Log Message:
Fix
% set x='a/b c/d.e'
% echo $x:q:h


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/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/csh/lex.c
diff -u src/bin/csh/lex.c:1.36 src/bin/csh/lex.c:1.37
--- src/bin/csh/lex.c:1.36	Sat Aug  8 20:34:21 2020
+++ src/bin/csh/lex.c	Wed Sep 30 13:51:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.36 2020/08/09 00:34:21 dholland Exp $ */
+/* $NetBSD: lex.c,v 1.37 2020/09/30 17:51:10 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.36 2020/08/09 00:34:21 dholland Exp $");
+__RCSID("$NetBSD: lex.c,v 1.37 2020/09/30 17:51:10 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -998,28 +998,26 @@ domod(Char *cp, int type)
 	return (wp);
 case 'h':
 case 't':
-	if (!any(short2str(cp), '/'))
-	return (type == 't' ? Strsave(cp) : 0);
-	wp = Strend(cp);
-	while (*--wp != '/')
-	continue;
-	if (type == 'h')
-	xp = Strsave(cp), xp[wp - cp] = 0;
-	else
+	wp = Strrchr(cp, '/');
+	if (wp == NULL)
+	return Strsave(type == 't' ? cp : STRNULL);
+	if (type == 't')
 	xp = Strsave(wp + 1);
+	else
+	xp = Strsave(cp), xp[wp - cp] = 0;
 	return (xp);
+
 case 'e':
 case 'r':
-	wp = Strend(cp);
-	for (wp--; wp >= cp && *wp != '/'; wp--)
-	if (*wp == '.') {
-		if (type == 'e')
-		xp = Strsave(wp + 1);
-		else
-		xp = Strsave(cp), xp[wp - cp] = 0;
-		return (xp);
-	}
-	return (Strsave(type == 'e' ? STRNULL : cp));
+	wp = Strrchr(cp, '.');
+	if (wp == NULL)
+	return Strsave(type == 'r' ? cp : STRNULL);
+	if (type == 'e')
+	xp = Strsave(wp + 1);
+	else
+	xp = Strsave(cp), xp[wp - cp] = 0;
+	return (xp);
+
 default:
 	break;
 }



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:53:38 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)

(part 2, the instance in this file was as far as I can tell
inexplicably missed by CVS on the first go...)


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/csh/csh.c

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



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:53:38 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)

(part 2, the instance in this file was as far as I can tell
inexplicably missed by CVS on the first go...)


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/csh/csh.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.52 src/bin/csh/csh.c:1.53
--- src/bin/csh/csh.c:1.52	Sun Aug  9 00:51:12 2020
+++ src/bin/csh/csh.c	Sun Aug  9 00:53:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $ */
+/* $NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $");
+__RCSID("$NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -697,7 +697,7 @@ importpath(Char *cp)
  * i+2 where i is the number of colons in the path. There are i+1
  * directories in the path plus we need room for a zero terminator.
  */
-pv = xcalloc((size_t) (i + 2), sizeof(Char **));
+pv = xcalloc((size_t) (i + 2), sizeof(*pv));
 dp = cp;
 i = 0;
 if (*dp)



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:51:13 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
Clarify some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/csh/csh.c

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



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:51:13 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
Clarify some comments.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/csh/csh.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.51 src/bin/csh/csh.c:1.52
--- src/bin/csh/csh.c:1.51	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/csh.c	Sun Aug  9 00:51:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -845,13 +845,12 @@ srcunit(int unit, int onlyown, int hflg)
 	int i;
 
 	/* We made it to the new state... free up its storage */
-	/* This code could get run twice but free doesn't care */
-	/* XXX yes it does */
 	for (i = 0; i < fblocks; i++)
 	free(fbuf[i]);
 	free(fbuf);
 
 	/* Reset input arena */
+	/* (note that this clears fbuf and fblocks) */
 	(void)memcpy(, , sizeof(B));
 
 	(void)close(SHIN), SHIN = oSHIN;



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:34:21 UTC 2020

Modified Files:
src/bin/csh: dir.c lex.c parse.c

Log Message:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/dir.c
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/lex.c
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/parse.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/csh/dir.c
diff -u src/bin/csh/dir.c:1.34 src/bin/csh/dir.c:1.35
--- src/bin/csh/dir.c:1.34	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/dir.c	Sun Aug  9 00:34:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: dir.c,v 1.35 2020/08/09 00:34:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: dir.c,v 1.35 2020/08/09 00:34:21 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -147,7 +147,7 @@ dset(Char *dp)
  * other junk characters glob will fail.
  */
 
-vec = xmalloc((size_t)(2 * sizeof(Char **)));
+vec = xmalloc(2 * sizeof(*vec));
 vec[0] = Strsave(dp);
 vec[1] = 0;
 setq(STRcwd, vec, );

Index: src/bin/csh/lex.c
diff -u src/bin/csh/lex.c:1.35 src/bin/csh/lex.c:1.36
--- src/bin/csh/lex.c:1.35	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/lex.c	Sun Aug  9 00:34:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: lex.c,v 1.36 2020/08/09 00:34:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: lex.c,v 1.36 2020/08/09 00:34:21 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -1453,7 +1453,8 @@ again:
 if (buf >= fblocks) {
 	Char **nfbuf;
 
-	nfbuf = xcalloc((size_t) (fblocks + 2), sizeof(char **));
+	/* XXX the cast is needed because fblocks is signed */
+	nfbuf = xcalloc((size_t)(fblocks + 2), sizeof(*nfbuf));
 	if (fbuf) {
 	(void)blkcpy(nfbuf, fbuf);
 	free(fbuf);
@@ -1623,7 +1624,7 @@ settell(void)
 	return;
 if (lseek(SHIN, (off_t) 0, SEEK_CUR) < 0 || errno == ESPIPE)
 	return;
-fbuf = xcalloc(2, sizeof(Char **));
+fbuf = xcalloc(2, sizeof(*fbuf));
 fblocks = 1;
 fbuf[0] = xcalloc(BUFSIZE, sizeof(Char));
 fseekp = fbobp = feobp = lseek(SHIN, (off_t) 0, SEEK_CUR);

Index: src/bin/csh/parse.c
diff -u src/bin/csh/parse.c:1.20 src/bin/csh/parse.c:1.21
--- src/bin/csh/parse.c:1.20	Sun Aug  9 00:22:53 2020
+++ src/bin/csh/parse.c	Sun Aug  9 00:34:21 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.20 2020/08/09 00:22:53 dholland Exp $ */
+/* $NetBSD: parse.c,v 1.21 2020/08/09 00:34:21 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)parse.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: parse.c,v 1.20 2020/08/09 00:22:53 dholland Exp $");
+__RCSID("$NetBSD: parse.c,v 1.21 2020/08/09 00:34:21 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -509,7 +509,8 @@ again:
 if (n < 0)
 	n = 0;
 t = xcalloc(1, sizeof(*t));
-av = xcalloc((size_t)(n + 1), sizeof(Char **));
+/* XXX the cast is needed because n is signed */
+av = xcalloc((size_t)(n + 1), sizeof(*av));
 t->t_dcom = av;
 n = 0;
 if (p2->word[0] == ')')



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:34:21 UTC 2020

Modified Files:
src/bin/csh: dir.c lex.c parse.c

Log Message:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/dir.c
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/lex.c
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/parse.c

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



CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:22:53 UTC 2020

Modified Files:
src/bin/csh: csh.c dir.c func.c lex.c parse.c proc.c

Log Message:
Don't cast the value returned from *malloc. No change to compiler output.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/dir.c
cvs rdiff -u -r1.43 -r1.44 src/bin/csh/func.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/lex.c
cvs rdiff -u -r1.19 -r1.20 src/bin/csh/parse.c
cvs rdiff -u -r1.39 -r1.40 src/bin/csh/proc.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.50 src/bin/csh/csh.c:1.51
--- src/bin/csh/csh.c:1.50	Fri Apr  3 18:11:29 2020
+++ src/bin/csh/csh.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $ */
+/* $NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $");
+__RCSID("$NetBSD: csh.c,v 1.51 2020/08/09 00:22:53 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -697,7 +697,7 @@ importpath(Char *cp)
  * i+2 where i is the number of colons in the path. There are i+1
  * directories in the path plus we need room for a zero terminator.
  */
-pv = (Char **)xcalloc((size_t) (i + 2), sizeof(Char **));
+pv = xcalloc((size_t) (i + 2), sizeof(Char **));
 dp = cp;
 i = 0;
 if (*dp)
@@ -1211,7 +1211,7 @@ process(int catch)
 	 * Made it!
 	 */
 	freelex();
-	freesyn((struct command *) savet), savet = NULL;
+	freesyn(savet), savet = NULL;
 }
 resexit(osetexit);
 savet = t;

Index: src/bin/csh/dir.c
diff -u src/bin/csh/dir.c:1.33 src/bin/csh/dir.c:1.34
--- src/bin/csh/dir.c:1.33	Fri Apr  3 18:11:29 2020
+++ src/bin/csh/dir.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $ */
+/* $NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.33 2020/04/03 18:11:29 joerg Exp $");
+__RCSID("$NetBSD: dir.c,v 1.34 2020/08/09 00:22:53 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -128,7 +128,7 @@ dinit(Char *hp)
 	}
 }
 
-dp = (struct directory *)xcalloc(1, sizeof(struct directory));
+dp = xcalloc(1, sizeof(*dp));
 dp->di_name = cp;
 dp->di_count = 0;
 dhead.di_next = dhead.di_prev = dp;
@@ -363,7 +363,7 @@ dochngd(Char **v, struct command *t)
 }
 else
 	cp = dfollow(*v);
-dp = (struct directory *)xcalloc(1, sizeof(struct directory));
+dp = xcalloc(1, sizeof(*dp));
 dp->di_name = cp;
 dp->di_count = 0;
 dp->di_next = dcwd->di_next;
@@ -510,7 +510,7 @@ dopushd(Char **v, struct command *t)
 	Char *ccp;
 
 	ccp = dfollow(*v);
-	dp = (struct directory *)xcalloc(1, sizeof(struct directory));
+	dp = xcalloc(1, sizeof(*dp));
 	dp->di_name = ccp;
 	dp->di_count = 0;
 	dp->di_prev = dcwd;

Index: src/bin/csh/func.c
diff -u src/bin/csh/func.c:1.43 src/bin/csh/func.c:1.44
--- src/bin/csh/func.c:1.43	Sun Jan  6 01:22:50 2019
+++ src/bin/csh/func.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $ */
+/* $NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)func.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $");
+__RCSID("$NetBSD: func.c,v 1.44 2020/08/09 00:22:53 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -414,7 +414,7 @@ doforeach(Char **v, struct command *t)
 v = globall(v);
 if (v == 0)
 	stderror(ERR_NAME | ERR_NOMATCH);
-nwp = (struct whyle *) xcalloc(1, sizeof *nwp);
+nwp = xcalloc(1, sizeof *nwp);
 nwp->w_fe = nwp->w_fe0 = v;
 gargv = 0;
 btell(>w_start);
@@ -452,7 +452,7 @@ dowhile(Char **v, struct command *t)
 	stderror(ERR_NAME | ERR_EXPRESSION);
 if (!again) {
 	struct whyle *nwp =
-	(struct whyle *)xcalloc(1, sizeof(*nwp));
+		xcalloc(1, sizeof(*nwp));
 
 	nwp->w_start = lineloc;
 	nwp->w_end.type = F_SEEK;

Index: src/bin/csh/lex.c
diff -u src/bin/csh/lex.c:1.34 src/bin/csh/lex.c:1.35
--- src/bin/csh/lex.c:1.34	Fri Feb  1 08:29:03 2019
+++ src/bin/csh/lex.c	Sun Aug  9 00:22:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.34 2019/02/01 08:29:03 mrg Exp $ */
+/* $NetBSD: lex.c,v 1.35 2020/08/09 00:22:53 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: lex.c,v 1.34 

CVS commit: src/bin/csh

2020-08-08 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Aug  9 00:22:53 UTC 2020

Modified Files:
src/bin/csh: csh.c dir.c func.c lex.c parse.c proc.c

Log Message:
Don't cast the value returned from *malloc. No change to compiler output.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/dir.c
cvs rdiff -u -r1.43 -r1.44 src/bin/csh/func.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/lex.c
cvs rdiff -u -r1.19 -r1.20 src/bin/csh/parse.c
cvs rdiff -u -r1.39 -r1.40 src/bin/csh/proc.c

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



CVS commit: src/bin/csh

2020-04-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Apr  3 18:11:29 UTC 2020

Modified Files:
src/bin/csh: csh.c csh.h dir.c dir.h proc.c proc.h

Log Message:
Don't depend on common declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/csh/csh.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/csh.h
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/dir.c
cvs rdiff -u -r1.8 -r1.9 src/bin/csh/dir.h
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/proc.c
cvs rdiff -u -r1.14 -r1.15 src/bin/csh/proc.h

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



CVS commit: src/bin/csh

2020-04-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Apr  3 18:11:29 UTC 2020

Modified Files:
src/bin/csh: csh.c csh.h dir.c dir.h proc.c proc.h

Log Message:
Don't depend on common declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/csh/csh.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/csh.h
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/dir.c
cvs rdiff -u -r1.8 -r1.9 src/bin/csh/dir.h
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/proc.c
cvs rdiff -u -r1.14 -r1.15 src/bin/csh/proc.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.49 src/bin/csh/csh.c:1.50
--- src/bin/csh/csh.c:1.49	Sun Jan 12 18:36:55 2020
+++ src/bin/csh/csh.c	Fri Apr  3 18:11:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $ */
+/* $NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.50 2020/04/03 18:11:29 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -77,6 +77,97 @@ __RCSID("$NetBSD: csh.c,v 1.49 2020/01/1
  * June, 1991
  */
 
+FILE *cshin, *cshout, *csherr;
+struct timespec time0;
+struct rusage ru0;
+struct varent shvhed, aliases;
+Char HISTSUB;
+int editing;
+
+int child;
+int chkstop;
+int didfds;
+int doneinp;
+int exiterr;
+int haderr;
+int havhash;
+int intact;
+int intty;
+int justpr;
+int loginsh;
+int neednote;
+int noexec;
+int pjobs;
+int setintr;
+int timflg;
+
+Char *arginp;
+Char *ffile;
+int onelflg;
+Char *shtemp;
+
+time_t chktim;
+Char *doldol;
+pid_t backpid;
+gid_t egid, gid;
+uid_t euid, uid;
+int shpgrp;
+int tpgrp;
+
+int opgrp;
+
+int SHIN;
+int SHOUT;
+int SHERR;
+int OLDSTD;
+
+jmp_buf reslab;
+
+Char *gointr;
+
+sig_t parintr;
+sig_t parterm;
+
+struct Bin B;
+
+struct Ain lineloc;
+int cantell;
+Char *lap;
+struct whyle *whyles;
+
+struct wordent *alhistp,*alhistt;
+
+int AsciiOnly;
+int gflag;
+long pnleft;
+Char *pargs;
+Char *pargcp;
+struct Hist Histlist;
+struct wordent paraml;
+int eventno;
+int lastev;
+Char HIST;
+Char HISTSUB;
+const char *bname;
+Char *Vsav;
+Char *Vdp;
+Char *Vexpath;
+char **Vt;
+Char **evalvec;
+Char *evalp;
+Char *word_chars;
+Char *STR_SHELLPATH;
+#ifdef _PATH_BSHELL
+Char *STR_BSHELL;
+#endif
+Char *STR_WORD_CHARS;
+Char **STR_environ;
+#ifdef EDIT
+EditLine *el;
+History *hi;
+#endif
+int editing;
+
 Char *dumphist[] = {STRhistory, STRmh, 0, 0};
 Char *tildehist[] = {STRsource, STRmh, STRtildothist, 0};
 

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.28 src/bin/csh/csh.h:1.29
--- src/bin/csh/csh.h:1.28	Sat Jan  5 16:54:00 2019
+++ src/bin/csh/csh.h	Fri Apr  3 18:11:29 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.28 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: csh.h,v 1.29 2020/04/03 18:11:29 joerg Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -89,7 +89,7 @@ typedef void *ioctl_t;		/* Third arg of 
 #define xcalloc(n, s) Calloc(n, s)
 
 #include 
-FILE *cshin, *cshout, *csherr;
+extern FILE *cshin, *cshout, *csherr;
 
 #define	isdir(d) (S_ISDIR(d.st_mode))
 
@@ -103,22 +103,22 @@ FILE *cshin, *cshout, *csherr;
 /*
  * Global flags
  */
-int child;			/* Child shell ... errors cause exit */
-int chkstop;			/* Warned of stopped jobs... allow exit */
-int didfds;			/* Have setup i/o fd's for child */
-int doneinp;			/* EOF indicator after reset from readc */
-int exiterr;			/* Exit if error or non-zero exit status */
-int haderr;			/* Reset was because of an error */
-int havhash;			/* path hashing is available */
-int intact;			/* We are interactive... therefore prompt */
-int intty;			/* Input is a tty */
-int justpr;			/* Just print because of :p hist mod */
-int loginsh;			/* We are a loginsh -> .login/.logout */
-int neednote;			/* Need to pnotify() */
-int noexec;			/* Don't execute, just syntax check */
-int pjobs;			/* want to print jobs if interrupted */
-int setintr;			/* Set interrupts on/off -> Wait intr... */
-int timflg;			/* Time the next waited for command */
+extern int child;		/* Child shell ... errors cause exit */
+extern int chkstop;		/* Warned of stopped jobs... allow exit */
+extern int didfds;		/* Have setup i/o fd's for child */
+extern int doneinp;		/* EOF indicator after reset from readc */
+extern int exiterr;		/* Exit if error or non-zero exit status */
+extern int haderr;		/* Reset was because of an error */
+extern int havhash;		/* path hashing is available */
+extern int intact;		/* We are interactive... therefore prompt */
+extern int intty;		/* Input is a tty */
+extern int justpr;		/* Just print because of :p hist mod */
+extern int loginsh;		/* We are a loginsh -> .login/.logout */
+extern int neednote;		/* Need to pnotify() */
+extern int 

CVS commit: src/bin/csh

2020-02-05 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Wed Feb  5 20:06:17 UTC 2020

Modified Files:
src/bin/csh: sem.c

Log Message:
bin/csh: Fix the -Wclobber warning.

Mark the variable as volatile as it can be clobbered when a vfork occurs.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/sem.c

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



CVS commit: src/bin/csh

2020-02-05 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Wed Feb  5 20:06:17 UTC 2020

Modified Files:
src/bin/csh: sem.c

Log Message:
bin/csh: Fix the -Wclobber warning.

Mark the variable as volatile as it can be clobbered when a vfork occurs.

Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.

Reviewed by: kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/sem.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/csh/sem.c
diff -u src/bin/csh/sem.c:1.31 src/bin/csh/sem.c:1.32
--- src/bin/csh/sem.c:1.31	Sat Jan  5 16:54:00 2019
+++ src/bin/csh/sem.c	Wed Feb  5 20:06:17 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.c,v 1.31 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: sem.c,v 1.32 2020/02/05 20:06:17 fox Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)sem.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: sem.c,v 1.31 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: sem.c,v 1.32 2020/02/05 20:06:17 fox Exp $");
 #endif
 #endif /* not lint */
 
@@ -67,7 +67,7 @@ execute(struct command *t, int wtty, int
 struct biltins * volatile bifunc;
 int pv[2], pid;
 sigset_t nsigset;
-int forked;
+volatile int forked;
 
 UNREGISTER(forked);
 UNREGISTER(bifunc);



CVS commit: src/bin/csh

2020-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 12 18:42:41 UTC 2020

Modified Files:
src/bin/csh: set.c

Log Message:
Add file completion.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/set.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/csh/set.c
diff -u src/bin/csh/set.c:1.36 src/bin/csh/set.c:1.37
--- src/bin/csh/set.c:1.36	Sat Jan 11 22:50:30 2020
+++ src/bin/csh/set.c	Sun Jan 12 13:42:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $ */
+/* $NetBSD: set.c,v 1.37 2020/01/12 18:42:41 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.37 2020/01/12 18:42:41 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -43,9 +43,7 @@ __RCSID("$NetBSD: set.c,v 1.36 2020/01/1
 #include 
 #include 
 
-#ifndef SHORT_STRINGS
 #include 
-#endif /* SHORT_STRINGS */
 
 #include "csh.h"
 #include "extern.h"
@@ -61,6 +59,41 @@ static void unsetv1(struct varent *);
 static void exportpath(Char **);
 static void balance(struct varent *, int, int);
 
+#ifdef EDIT
+static const char *
+alias_text(void *dummy __unused, const char *name)
+{
+	static char *buf;
+	struct varent *vp;
+	Char **av;
+	char *p;
+	size_t len;
+
+	vp = adrof1(str2short(name), );
+	if (vp == NULL)
+	return NULL;
+
+	len = 0;
+	for (av = vp->vec; *av; av++) {
+	len += strlen(vis_str(*av));
+	if (av[1])
+		len++;
+	}
+	len++;
+	free(buf);
+	p = buf = xmalloc(len);
+	for (av = vp->vec; *av; av++) {
+	const char *s = vis_str(*av);
+	while ((*p++ = *s++) != '\0')
+		continue;
+	if (av[1])
+		*p++ = ' ';
+	}
+	*p = '\0';
+	return buf;
+}
+#endif
+
 /*
  * C Shell
  */
@@ -124,6 +157,11 @@ update_vars(Char *vp)
 	SHIN, SHOUT, SHERR);
 	el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs");
 	el_set(el, EL_PROMPT, printpromptstr);
+	el_set(el, EL_ALIAS_TEXT, alias_text, NULL);
+	el_set(el, EL_ADDFN, "rl-complete",
+	"ReadLine compatible completion function", _el_fn_complete);
+	el_set(el, EL_BIND, "^I", adrof(STRfilec) ? "rl-complete" : "ed-insert",
+	NULL);
 	hi = history_init();
 	history(hi, , H_SETSIZE, getn(value(STRhistory)));
 	loadhist(Histlist.Hnext);



CVS commit: src/bin/csh

2020-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 12 18:42:41 UTC 2020

Modified Files:
src/bin/csh: set.c

Log Message:
Add file completion.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2020-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 12 18:36:55 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/csh/csh.c

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



CVS commit: src/bin/csh

2020-01-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 12 18:36:55 UTC 2020

Modified Files:
src/bin/csh: csh.c

Log Message:
remove unused


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/csh/csh.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/csh/csh.c
diff -u src/bin/csh/csh.c:1.48 src/bin/csh/csh.c:1.49
--- src/bin/csh/csh.c:1.48	Sat Jan  5 11:54:00 2019
+++ src/bin/csh/csh.c	Sun Jan 12 13:36:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.49 2020/01/12 18:36:55 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -105,9 +105,6 @@ static void mailchk(void);
 #ifndef _PATH_DEFPATH
 static Char **defaultpath(void);
 #endif
-#ifdef EDITING
-int	editing = 0;
-#endif
 
 int
 main(int argc, char *argv[])



CVS commit: src/bin/csh

2020-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 12 03:50:30 UTC 2020

Modified Files:
src/bin/csh: set.c

Log Message:
PR/54853: Greg Oster: unable to 'unset filec' or 'unset edit' in csh
While here allow set edit=vi


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2020-01-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 12 03:50:30 UTC 2020

Modified Files:
src/bin/csh: set.c

Log Message:
PR/54853: Greg Oster: unable to 'unset filec' or 'unset edit' in csh
While here allow set edit=vi


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/set.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/csh/set.c
diff -u src/bin/csh/set.c:1.35 src/bin/csh/set.c:1.36
--- src/bin/csh/set.c:1.35	Sat Jan  5 11:54:00 2019
+++ src/bin/csh/set.c	Sat Jan 11 22:50:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.35 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: set.c,v 1.35 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: set.c,v 1.36 2020/01/12 03:50:30 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -117,10 +117,12 @@ update_vars(Char *vp)
 #ifdef EDIT
 else if (eq(vp, STRedit)) {
 	HistEvent ev;
+	Char *vn = value(STRhistchars);
+
 	editing = 1;
 	el = el_init_fd(getprogname(), cshin, cshout, csherr,
 	SHIN, SHOUT, SHERR);
-	el_set(el, EL_EDITOR, "emacs");
+	el_set(el, EL_EDITOR, *vn ? short2str(vn) : "emacs");
 	el_set(el, EL_PROMPT, printpromptstr);
 	hi = history_init();
 	history(hi, , H_SETSIZE, getn(value(STRhistory)));
@@ -518,16 +520,18 @@ unset(Char **v, struct command *t)
 	HIST = '!';
 	HISTSUB = '^';
 }
-else if (adrof(STRwordchars) == 0)
+if (adrof(STRwordchars) == 0)
 	word_chars = STR_WORD_CHARS;
 #ifdef FILEC
-else if (adrof(STRfilec) == 0)
+if (adrof(STRfilec) == 0)
 	filec = 0;
 #endif
 #ifdef EDIT
-else if (adrof(STRedit) == 0) {
-	el_end(el);
-	history_end(hi);
+if (adrof(STRedit) == 0) {
+	if (el)
+	el_end(el);
+	if (hi)
+	history_end(hi);
 	el = NULL;
 	hi = NULL;
 	editing = 0;



CVS commit: src/bin/csh

2019-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 01:22:50 UTC 2019

Modified Files:
src/bin/csh: func.c

Log Message:
PR/53837: Michael Scholz: src/bin/csh/func.c from current has a superfluous
fprintf


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/csh/func.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/csh/func.c
diff -u src/bin/csh/func.c:1.42 src/bin/csh/func.c:1.43
--- src/bin/csh/func.c:1.42	Sat Jan  5 11:54:00 2019
+++ src/bin/csh/func.c	Sat Jan  5 20:22:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.42 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)func.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: func.c,v 1.42 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: func.c,v 1.43 2019/01/06 01:22:50 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -619,7 +619,6 @@ search(int type, int level, Char *goal)
 	if (lastchr(aword) == ':')
 		aword[Strlen(aword) - 1] = 0;
 	cp = strip(Dfix1(aword));
-	fprintf(cshout, "%s\n", short2str(cp));
 	if (Gmatch(goal, cp))
 		level = -1;
 	free(cp);



CVS commit: src/bin/csh

2019-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 01:22:50 UTC 2019

Modified Files:
src/bin/csh: func.c

Log Message:
PR/53837: Michael Scholz: src/bin/csh/func.c from current has a superfluous
fprintf


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/csh/func.c

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



CVS commit: src/bin/csh

2019-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  5 16:56:25 UTC 2019

Modified Files:
src/bin/csh: glob.c

Log Message:
put back x in xrealloc


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/glob.c

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



CVS commit: src/bin/csh

2019-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  5 16:56:25 UTC 2019

Modified Files:
src/bin/csh: glob.c

Log Message:
put back x in xrealloc


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/glob.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/csh/glob.c
diff -u src/bin/csh/glob.c:1.30 src/bin/csh/glob.c:1.31
--- src/bin/csh/glob.c:1.30	Sat Jan  5 11:54:00 2019
+++ src/bin/csh/glob.c	Sat Jan  5 11:56:25 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: glob.c,v 1.30 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: glob.c,v 1.31 2019/01/05 16:56:25 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)glob.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: glob.c,v 1.30 2019/01/05 16:54:00 christos Exp $");
+__RCSID("$NetBSD: glob.c,v 1.31 2019/01/05 16:56:25 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -197,7 +197,7 @@ globbrace(Char *s, Char *p, Char ***bl)
 		pl = pm + 1;
 		if (vl == [size]) {
 		size += GLOBSPACE;
-		nv = realloc(nv, (size_t)size * sizeof(Char *));
+		nv = xrealloc(nv, (size_t)size * sizeof(Char *));
 		vl = [size - GLOBSPACE];
 		}
 	}



CVS commit: src/bin/csh

2019-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  5 16:54:00 UTC 2019

Modified Files:
src/bin/csh: alloc.c csh.c csh.h dir.c dol.c err.c exec.c exp.c
extern.h file.c func.c glob.c hist.c lex.c misc.c parse.c proc.c
sem.c set.c str.c

Log Message:
Welcome to the 21th century csh: retire "ptr_t" now that we have "void *"


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/bin/csh/alloc.c
cvs rdiff -u -r1.47 -r1.48 src/bin/csh/csh.c
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/csh.h
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/dir.c src/bin/csh/file.c
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/dol.c src/bin/csh/extern.h \
src/bin/csh/sem.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/err.c
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/exec.c src/bin/csh/lex.c
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/exp.c src/bin/csh/hist.c \
src/bin/csh/misc.c
cvs rdiff -u -r1.41 -r1.42 src/bin/csh/func.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/glob.c
cvs rdiff -u -r1.18 -r1.19 src/bin/csh/parse.c
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/proc.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/set.c
cvs rdiff -u -r1.15 -r1.16 src/bin/csh/str.c

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



CVS commit: src/bin/csh

2019-01-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  5 16:54:00 UTC 2019

Modified Files:
src/bin/csh: alloc.c csh.c csh.h dir.c dol.c err.c exec.c exp.c
extern.h file.c func.c glob.c hist.c lex.c misc.c parse.c proc.c
sem.c set.c str.c

Log Message:
Welcome to the 21th century csh: retire "ptr_t" now that we have "void *"


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/bin/csh/alloc.c
cvs rdiff -u -r1.47 -r1.48 src/bin/csh/csh.c
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/csh.h
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/dir.c src/bin/csh/file.c
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/dol.c src/bin/csh/extern.h \
src/bin/csh/sem.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/err.c
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/exec.c src/bin/csh/lex.c
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/exp.c src/bin/csh/hist.c \
src/bin/csh/misc.c
cvs rdiff -u -r1.41 -r1.42 src/bin/csh/func.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/glob.c
cvs rdiff -u -r1.18 -r1.19 src/bin/csh/parse.c
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/proc.c
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/set.c
cvs rdiff -u -r1.15 -r1.16 src/bin/csh/str.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/csh/alloc.c
diff -u src/bin/csh/alloc.c:1.14 src/bin/csh/alloc.c:1.15
--- src/bin/csh/alloc.c:1.14	Sat Jan  5 05:51:06 2019
+++ src/bin/csh/alloc.c	Sat Jan  5 11:54:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: alloc.c,v 1.15 2019/01/05 16:54:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)alloc.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.15 2019/01/05 16:54:00 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -47,36 +47,36 @@ __RCSID("$NetBSD: alloc.c,v 1.14 2019/01
 #include "csh.h"
 #include "extern.h"
 
-ptr_t
+void *
 Malloc(size_t n)
 {
-ptr_t ptr;
+void *ptr;
 
-if ((ptr = malloc(n)) == (ptr_t) 0) {
+if ((ptr = malloc(n)) == NULL) {
 	child++;
 	stderror(ERR_NOMEM);
 }
 return (ptr);
 }
 
-ptr_t
-Realloc(ptr_t p, size_t n)
+void *
+Realloc(void *p, size_t n)
 {
-ptr_t ptr;
+void *ptr;
 
-if ((ptr = realloc(p, n)) == (ptr_t) 0) {
+if ((ptr = realloc(p, n)) == NULL) {
 	child++;
 	stderror(ERR_NOMEM);
 }
 return (ptr);
 }
 
-ptr_t
+void *
 Calloc(size_t s, size_t n)
 {
-ptr_t ptr;
+void *ptr;
 
-if ((ptr = calloc(s, n)) == (ptr_t) 0) {
+if ((ptr = calloc(s, n)) == NULL) {
 	child++;
 	stderror(ERR_NOMEM);
 }

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.47 src/bin/csh/csh.c:1.48
--- src/bin/csh/csh.c:1.47	Sat Jan  5 05:51:06 2019
+++ src/bin/csh/csh.c	Sat Jan  5 11:54:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $");
+__RCSID("$NetBSD: csh.c,v 1.48 2019/01/05 16:54:00 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -641,7 +641,7 @@ srccat(Char *cp, Char *dp)
 
 ep = Strspl(cp, dp);
 ptr = short2str(ep);
-free((ptr_t) ep);
+free(ep);
 return srcfile(ptr, mflag ? 0 : 1, 0);
 }
 
@@ -760,8 +760,8 @@ srcunit(int unit, int onlyown, int hflg)
 	/* This code could get run twice but free doesn't care */
 	/* XXX yes it does */
 	for (i = 0; i < fblocks; i++)
-	free((ptr_t) fbuf[i]);
-	free((ptr_t) fbuf);
+	free(fbuf[i]);
+	free(fbuf);
 
 	/* Reset input arena */
 	(void)memcpy(, , sizeof(B));
@@ -1062,7 +1062,7 @@ process(int catch)
 	(void)fflush(cshout);
 	}
 	if (seterr) {
-	free((ptr_t) seterr);
+	free(seterr);
 	seterr = NULL;
 	}
 
@@ -1146,7 +1146,7 @@ dosource(Char **v, struct command *t)
 (void)Strcpy(buf, *v);
 f = globone(buf, G_ERROR);
 (void)strcpy((char *)buf, short2str(f));
-free((ptr_t) f);
+free(f);
 if (!srcfile((char *)buf, 0, hflg) && !hflg)
 	stderror(ERR_SYSTEM, (char *)buf, strerror(errno));
 }

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.27 src/bin/csh/csh.h:1.28
--- src/bin/csh/csh.h:1.27	Sat Jan  5 05:51:06 2019
+++ src/bin/csh/csh.h	Sat Jan  5 11:54:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.27 2019/01/05 10:51:06 maya Exp $ */
+/* $NetBSD: csh.h,v 1.28 2019/01/05 16:54:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -80,8 +80,6 @@ typedef char Char;
 
 typedef void *ioctl_t;		/* Third arg of ioctl */
 
-typedef void *ptr_t;
-
 #include "const.h"
 #include "char.h"
 #include "errnum.h"

Index: src/bin/csh/dir.c
diff -u src/bin/csh/dir.c:1.31 src/bin/csh/dir.c:1.32

CVS commit: src/bin/csh

2019-01-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Jan  5 10:51:06 UTC 2019

Modified Files:
src/bin/csh: alloc.c csh.c csh.h dir.c dol.c err.c exec.c exp.c file.c
func.c glob.c hist.c lex.c misc.c parse.c proc.c sem.c set.c

Log Message:
Remove Free, s/xfree/free/.

Standard C says that free should be a no-op for a NULL pointer, so
we don't need an extra function to do this.

While here, add an XXX about a wrong sounding comment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/csh/alloc.c
cvs rdiff -u -r1.46 -r1.47 src/bin/csh/csh.c
cvs rdiff -u -r1.26 -r1.27 src/bin/csh/csh.h
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/dir.c src/bin/csh/file.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/dol.c src/bin/csh/sem.c
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/err.c
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/exec.c src/bin/csh/lex.c
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/exp.c src/bin/csh/hist.c \
src/bin/csh/misc.c
cvs rdiff -u -r1.40 -r1.41 src/bin/csh/func.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/glob.c
cvs rdiff -u -r1.17 -r1.18 src/bin/csh/parse.c
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/proc.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2019-01-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Jan  5 10:51:06 UTC 2019

Modified Files:
src/bin/csh: alloc.c csh.c csh.h dir.c dol.c err.c exec.c exp.c file.c
func.c glob.c hist.c lex.c misc.c parse.c proc.c sem.c set.c

Log Message:
Remove Free, s/xfree/free/.

Standard C says that free should be a no-op for a NULL pointer, so
we don't need an extra function to do this.

While here, add an XXX about a wrong sounding comment


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/bin/csh/alloc.c
cvs rdiff -u -r1.46 -r1.47 src/bin/csh/csh.c
cvs rdiff -u -r1.26 -r1.27 src/bin/csh/csh.h
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/dir.c src/bin/csh/file.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/dol.c src/bin/csh/sem.c
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/err.c
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/exec.c src/bin/csh/lex.c
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/exp.c src/bin/csh/hist.c \
src/bin/csh/misc.c
cvs rdiff -u -r1.40 -r1.41 src/bin/csh/func.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/glob.c
cvs rdiff -u -r1.17 -r1.18 src/bin/csh/parse.c
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/proc.c
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/set.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/csh/alloc.c
diff -u src/bin/csh/alloc.c:1.13 src/bin/csh/alloc.c:1.14
--- src/bin/csh/alloc.c:1.13	Tue Jan 22 19:28:00 2013
+++ src/bin/csh/alloc.c	Sat Jan  5 10:51:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $ */
+/* $NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $ */
 
 /*-
  * Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)alloc.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.14 2019/01/05 10:51:06 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -82,10 +82,3 @@ Calloc(size_t s, size_t n)
 }
 return (ptr);
 }
-
-void
-Free(ptr_t p)
-{
-if (p)
-	free(p);
-}

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.46 src/bin/csh/csh.c:1.47
--- src/bin/csh/csh.c:1.46	Tue Jul 16 17:47:43 2013
+++ src/bin/csh/csh.c	Sat Jan  5 10:51:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.46 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)csh.c	8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.46 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: csh.c,v 1.47 2019/01/05 10:51:06 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -641,7 +641,7 @@ srccat(Char *cp, Char *dp)
 
 ep = Strspl(cp, dp);
 ptr = short2str(ep);
-xfree((ptr_t) ep);
+free((ptr_t) ep);
 return srcfile(ptr, mflag ? 0 : 1, 0);
 }
 
@@ -757,10 +757,11 @@ srcunit(int unit, int onlyown, int hflg)
 	int i;
 
 	/* We made it to the new state... free up its storage */
-	/* This code could get run twice but xfree doesn't care */
+	/* This code could get run twice but free doesn't care */
+	/* XXX yes it does */
 	for (i = 0; i < fblocks; i++)
-	xfree((ptr_t) fbuf[i]);
-	xfree((ptr_t) fbuf);
+	free((ptr_t) fbuf[i]);
+	free((ptr_t) fbuf);
 
 	/* Reset input arena */
 	(void)memcpy(, , sizeof(B));
@@ -1061,7 +1062,7 @@ process(int catch)
 	(void)fflush(cshout);
 	}
 	if (seterr) {
-	xfree((ptr_t) seterr);
+	free((ptr_t) seterr);
 	seterr = NULL;
 	}
 
@@ -1145,7 +1146,7 @@ dosource(Char **v, struct command *t)
 (void)Strcpy(buf, *v);
 f = globone(buf, G_ERROR);
 (void)strcpy((char *)buf, short2str(f));
-xfree((ptr_t) f);
+free((ptr_t) f);
 if (!srcfile((char *)buf, 0, hflg) && !hflg)
 	stderror(ERR_SYSTEM, (char *)buf, strerror(errno));
 }

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.26 src/bin/csh/csh.h:1.27
--- src/bin/csh/csh.h:1.26	Tue Jul 16 17:47:43 2013
+++ src/bin/csh/csh.h	Sat Jan  5 10:51:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.26 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: csh.h,v 1.27 2019/01/05 10:51:06 maya Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -89,7 +89,6 @@ typedef void *ptr_t;
 #define xmalloc(i) Malloc(i)
 #define xrealloc(p, i) Realloc(p, i)
 #define xcalloc(n, s) Calloc(n, s)
-#define xfree(p) Free(p)
 
 #include 
 FILE *cshin, *cshout, *csherr;

Index: src/bin/csh/dir.c
diff -u src/bin/csh/dir.c:1.30 src/bin/csh/dir.c:1.31
--- src/bin/csh/dir.c:1.30	Tue Jul 16 17:47:43 2013
+++ src/bin/csh/dir.c	Sat Jan  5 10:51:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.30 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: dir.c,v 1.31 2019/01/05 10:51:06 maya Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dir.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dir.c,v 1.30 2013/07/16 17:47:43 

CVS commit: src/bin/csh

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 14:35:55 UTC 2017

Modified Files:
src/bin/csh: extern.h time.c

Log Message:
Add a variant that passes the format, so that time(1) can use it.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/extern.h
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/time.c

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



CVS commit: src/bin/csh

2017-07-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jul 15 14:35:55 UTC 2017

Modified Files:
src/bin/csh: extern.h time.c

Log Message:
Add a variant that passes the format, so that time(1) can use it.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/extern.h
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/time.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/csh/extern.h
diff -u src/bin/csh/extern.h:1.29 src/bin/csh/extern.h:1.30
--- src/bin/csh/extern.h:1.29	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/extern.h	Sat Jul 15 10:35:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.29 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: extern.h,v 1.30 2017/07/15 14:35:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -297,6 +297,8 @@ void plist(struct varent *);
  */
 void donice(Char **, struct command *);
 void dotime(Char **, struct command *);
+void prusage1(FILE *, const char *, struct rusage *, struct rusage *,
+	 struct timespec *, struct timespec *);
 void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
  struct timespec *);
 void ruadd(struct rusage *, struct rusage *);

Index: src/bin/csh/time.c
diff -u src/bin/csh/time.c:1.20 src/bin/csh/time.c:1.21
--- src/bin/csh/time.c:1.20	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/time.c	Sat Jul 15 10:35:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: time.c,v 1.20 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: time.c,v 1.21 2017/07/15 14:35:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: time.c,v 1.20 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: time.c,v 1.21 2017/07/15 14:35:55 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -124,32 +124,37 @@ ruadd(struct rusage *ru, struct rusage *
 ru->ru_nvcsw += ru2->ru_nvcsw;
 ru->ru_nivcsw += ru2->ru_nivcsw;
 }
-#endif /* NOT_CSH */
 
 void
 prusage(FILE *fp, struct rusage *r0, struct rusage *r1, struct timespec *e,
 struct timespec *b)
 {
-#ifndef NOT_CSH
 struct varent *vp;
-#endif
 const char *cp;
+
+vp = adrof(STRtime);
+
+if (vp && vp->vec[0] && vp->vec[1])
+	cp = short2str(vp->vec[1]);
+else
+	cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
+prusage1(fp, cp, r0, r1, e, b);
+}
+#endif
+
+void
+prusage1(FILE *fp, const char *cp, struct rusage *r0, struct rusage *r1,
+struct timespec *e, struct timespec *b)
+{
 long i;
 time_t t;
 time_t ms;
 
-cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
 ms = (e->tv_sec - b->tv_sec) * 100 + (e->tv_nsec - b->tv_nsec) / 1000;
 t = (r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
 (r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 1 +
 (r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
 (r1->ru_stime.tv_usec - r0->ru_stime.tv_usec) / 1;
-#ifndef NOT_CSH
-vp = adrof(STRtime);
-
-if (vp && vp->vec[0] && vp->vec[1])
-	cp = short2str(vp->vec[1]);
-#endif
 
 for (; *cp; cp++)
 	if (*cp != '%')



CVS commit: src/bin/csh

2017-04-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 27 18:50:34 UTC 2017

Modified Files:
src/bin/csh: glob.c

Log Message:
switch to a backtracking instead of a recursive pattern matcher.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/glob.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/csh/glob.c
diff -u src/bin/csh/glob.c:1.27 src/bin/csh/glob.c:1.28
--- src/bin/csh/glob.c:1.27	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/glob.c	Thu Apr 27 14:50:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: glob.c,v 1.27 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: glob.c,v 1.28 2017/04/27 18:50:34 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)glob.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: glob.c,v 1.27 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: glob.c,v 1.28 2017/04/27 18:50:34 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -89,7 +89,7 @@ static Char **libglob(Char **);
 static Char **globexpand(Char **);
 static int globbrace(Char *, Char *, Char ***);
 static void expbrace(Char ***, Char ***, size_t);
-static int pmatch(Char *, Char *);
+static int pmatch(const Char *, const Char *);
 static void pword(void);
 static void psave(int);
 static void backeval(Char *, int);
@@ -818,56 +818,74 @@ Gmatch(Char *string, Char *pattern)
 } 
 
 static int
-pmatch(Char *string, Char *pattern)
+pmatch(const Char *name, const Char *pat)
 {
 int match, negate_range;
-Char patternc, rangec, stringc;
+Char patc, namec, c;
+const Char *nameNext, *nameStart, *nameEnd, *patNext;
 
-for (;; ++string) {
-	stringc = *string & TRIM;
-	patternc = *pattern++;
-	switch (patternc) {
+nameNext = nameStart = name;
+patNext = pat;
+nameEnd = NULL;
+
+for (;;) {
+	namec = *name & TRIM;
+	if (namec == 0)
+	nameEnd = name;
+	patc = *pat;
+	switch (patc) {
 	case 0:
-	return (stringc == 0);
-	case '?':
-	if (stringc == 0)
-		return (0);
+	if (namec == 0)
+		return 1;
 	break;
+	case '?':
+	if (namec == 0)
+		break;
+	pat++;
+	name++;
+	continue;
 	case '*':
-	if (!*pattern)
-		return (1);
-	while (*string)
-		if (Gmatch(string++, pattern))
-		return (1);
-	return (0);
+	while ((pat[1] & TRIM) == '*')
+		pat++;
+	patNext = pat;
+	nameNext = name + 1;
+	pat++;
+	continue;
 	case '[':
 	match = 0;
-	if ((negate_range = (*pattern == '^')) != 0)
-		pattern++;
-	while ((rangec = *pattern++) != '\0') {
-		if (rangec == ']')
-		break;
-		if (match)
-		continue;
-		if (rangec == '-' && *(pattern-2) != '[' && *pattern  != ']') {
-		match = (stringc <= (*pattern & TRIM) &&
-			  (*(pattern-2) & TRIM) <= stringc);
-		pattern++;
-		}
-		else 
-		match = (stringc == (rangec & TRIM));
+	if (namec == 0)
+		break;
+	pat++;
+	name++;
+	if ((negate_range = (*pat == '^')) != 0)
+		pat++;
+	while ((c = *pat++) != ']') {
+		c &= TRIM;
+		if (*pat == '-') {
+		if (c <= namec && namec <= (pat[1] & TRIM))
+			match = 1;
+		pat += 2;
+		} else if (c == namec)
+		match = 1;
+		else if (c == 0)
+		stderror(ERR_NAME | ERR_MISSING, ']');
 	}
-	if (rangec == 0)
-		stderror(ERR_NAME | ERR_MISSING, ']');
 	if (match == negate_range)
-		return (0);
-	break;
+		break;
+	continue;
 	default:
-	if ((patternc & TRIM) != stringc)
-		return (0);
-	break;
-
+	if ((patc & TRIM) != namec)
+		break;
+	pat++;
+	name++;
+	continue;
+	}
+	if (nameNext != nameStart && (nameEnd == NULL || nameNext <= nameEnd)) {
+	pat = patNext;
+	name = nameNext;
+	continue;
 	}
+	return 0;
 }
 }
 



CVS commit: src/bin/csh

2017-04-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 27 18:50:34 UTC 2017

Modified Files:
src/bin/csh: glob.c

Log Message:
switch to a backtracking instead of a recursive pattern matcher.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/glob.c

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



CVS commit: src/bin/csh

2016-08-10 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Aug 10 17:16:47 UTC 2016

Modified Files:
src/bin/csh: csh.1

Log Message:
C Shell appeared in 2BSD, not 3BSD


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/csh/csh.1

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



CVS commit: src/bin/csh

2016-08-10 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Wed Aug 10 17:16:47 UTC 2016

Modified Files:
src/bin/csh: csh.1

Log Message:
C Shell appeared in 2BSD, not 3BSD


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/csh/csh.1

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

Modified files:

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.52 src/bin/csh/csh.1:1.53
--- src/bin/csh/csh.1:1.52	Tue Jan 22 21:20:26 2013
+++ src/bin/csh/csh.1	Wed Aug 10 17:16:47 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: csh.1,v 1.52 2013/01/22 21:20:26 wiz Exp $
+.\"	$NetBSD: csh.1,v 1.53 2016/08/10 17:16:47 sevan Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)csh.1	8.2 (Berkeley) 1/21/94
 .\"
-.Dd January 22, 2013
+.Dd August 8, 2016
 .Dt CSH 1
 .Os
 .Sh NAME
@@ -2233,7 +2233,7 @@ substitutions on a single line to 20.
 .Sh HISTORY
 .Nm
 appeared in
-.Bx 3 .
+.Bx 2 .
 It was a first implementation of a command language interpreter
 incorporating a history mechanism (see
 .Sx History substitutions ) ,



CVS commit: src/bin/csh

2016-03-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 22:35:45 UTC 2016

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

Log Message:
add Will Robinson comment.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/exec.c

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



CVS commit: src/bin/csh

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 22:25:05 UTC 2016

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

Log Message:
Avoid gcc-5 conversion warning (|= expands to int)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/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/csh/exec.c
diff -u src/bin/csh/exec.c:1.29 src/bin/csh/exec.c:1.30
--- src/bin/csh/exec.c:1.29	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/exec.c	Wed Mar 16 18:25:05 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.29 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: exec.c,v 1.30 2016/03/16 22:25:05 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)exec.c	8.3 (Berkeley) 5/23/95";
 #else
-__RCSID("$NetBSD: exec.c,v 1.29 2013/07/16 17:47:43 christos Exp $");
+__RCSID("$NetBSD: exec.c,v 1.30 2016/03/16 22:25:05 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,7 +91,8 @@ static unsigned char xhash[HSHSIZ / 8];
 
 #define hash(a, b) (((a) * HSHMUL + (b)) & HSHMASK)
 #define bit(h, b) ((h)[(b) >> 3] & 1 << ((b) & 7))	/* bit test */
-#define bis(h, b) ((h)[(b) >> 3] |= (unsigned char)(1 << ((b) & 7)))	/* bit set */
+#define bis(h, b) ((h)[(b) >> 3] = \
+(unsigned char)((1 << ((b) & 7)) | (h)[(b) >> 3]))/* bit set */
 static int hits, misses;
 
 /* Dummy search path for just absolute search when no path */



CVS commit: src/bin/csh

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 22:35:45 UTC 2016

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

Log Message:
add Will Robinson comment.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/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/csh/exec.c
diff -u src/bin/csh/exec.c:1.30 src/bin/csh/exec.c:1.31
--- src/bin/csh/exec.c:1.30	Wed Mar 16 18:25:05 2016
+++ src/bin/csh/exec.c	Wed Mar 16 18:35:44 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.30 2016/03/16 22:25:05 christos Exp $ */
+/* $NetBSD: exec.c,v 1.31 2016/03/16 22:35:44 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)exec.c	8.3 (Berkeley) 5/23/95";
 #else
-__RCSID("$NetBSD: exec.c,v 1.30 2016/03/16 22:25:05 christos Exp $");
+__RCSID("$NetBSD: exec.c,v 1.31 2016/03/16 22:35:44 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -90,6 +90,7 @@ static Char *expath;		/* Path for exerr 
 static unsigned char xhash[HSHSIZ / 8];
 
 #define hash(a, b) (((a) * HSHMUL + (b)) & HSHMASK)
+/* these macros eval their arguments multiple times, so be careful */
 #define bit(h, b) ((h)[(b) >> 3] & 1 << ((b) & 7))	/* bit test */
 #define bis(h, b) ((h)[(b) >> 3] = \
 (unsigned char)((1 << ((b) & 7)) | (h)[(b) >> 3]))/* bit set */



CVS commit: src/bin/csh

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 22:25:05 UTC 2016

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

Log Message:
Avoid gcc-5 conversion warning (|= expands to int)


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/exec.c

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



CVS commit: src/bin/csh

2014-07-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jul  5 23:12:33 UTC 2014

Modified Files:
src/bin/csh: Makefile

Log Message:
remove .if make(install)
these are seriously bad juju


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/csh/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/csh/Makefile
diff -u src/bin/csh/Makefile:1.40 src/bin/csh/Makefile:1.41
--- src/bin/csh/Makefile:1.40	Fri Jun 13 01:17:45 2014
+++ src/bin/csh/Makefile	Sat Jul  5 23:12:33 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.40 2014/06/13 01:17:45 mrg Exp $
+#	$NetBSD: Makefile,v 1.41 2014/07/05 23:12:33 dholland Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -52,9 +52,7 @@ const.h: const.c
 	${TOOL_SED} -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
 	sort  ${.TARGET}
 
-.if make(install)
 SUBDIR+=USD.doc
-.endif
 
 COPTS.err.c = -Wno-format-nonliteral
 COPTS.printf.c = -Wno-format-nonliteral



CVS commit: src/bin/csh

2014-07-05 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Jul  5 23:12:33 UTC 2014

Modified Files:
src/bin/csh: Makefile

Log Message:
remove .if make(install)
these are seriously bad juju


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/csh/Makefile

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



Re: CVS commit: src/bin/csh

2013-08-06 Thread Alan Barrett

On Tue, 06 Aug 2013, Christos Zoulas wrote:

Module Name:src
Committed By:   christos
Date:   Tue Aug  6 05:42:43 UTC 2013

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

Log Message:
CID 1060854: Wrong sizeof argument (SIZEOF_MISMATCH)


Does everybody know what CID means?  I'd be inclined to say 
Coverity CID  instead of just CID  in these log 
messages.


--apb (Alan Barrett)


Re: CVS commit: src/bin/csh

2013-08-06 Thread Greg Troxel

Alan Barrett a...@cequrux.com writes:

 On Tue, 06 Aug 2013, Christos Zoulas wrote:
Module Name:  src
Committed By: christos
Date: Tue Aug  6 05:42:43 UTC 2013

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

Log Message:
CID 1060854: Wrong sizeof argument (SIZEOF_MISMATCH)

 Does everybody know what CID means?  I'd be inclined to say
 Coverity CID  instead of just CID  in these log messages.

 --apb (Alan Barrett)

Also, the CIDs don't seem to be a stable hash of the bug :-), so really
this is an id from a particular instatiation of the tool, and a name
for that instatiation belongs too.


pgpN9UT2xrBi8.pgp
Description: PGP signature


CVS commit: src/bin/csh

2013-08-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  6 05:42:43 UTC 2013

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

Log Message:
CID 1060854: Wrong sizeof argument (SIZEOF_MISMATCH)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/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/csh/lex.c
diff -u src/bin/csh/lex.c:1.30 src/bin/csh/lex.c:1.31
--- src/bin/csh/lex.c:1.30	Tue Jul 16 13:47:43 2013
+++ src/bin/csh/lex.c	Tue Aug  6 01:42:43 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.30 2013/07/16 17:47:43 christos Exp $ */
+/* $NetBSD: lex.c,v 1.31 2013/08/06 05:42:43 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)lex.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: lex.c,v 1.30 2013/07/16 17:47:43 christos Exp $);
+__RCSID($NetBSD: lex.c,v 1.31 2013/08/06 05:42:43 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -1495,7 +1495,7 @@ again:
 		}
 		if (c  0)
 		(void)memcpy(fbuf[buf] + off, ttyline,
-			(size_t)c * sizeof(*fbuf));
+			(size_t)c * sizeof(**fbuf));
 		numleft = 0;
 	}
 	else {



CVS commit: src/bin/csh

2013-08-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  6 05:42:43 UTC 2013

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

Log Message:
CID 1060854: Wrong sizeof argument (SIZEOF_MISMATCH)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/lex.c

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



CVS commit: src/bin/csh

2013-07-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 16 17:47:43 UTC 2013

Modified Files:
src/bin/csh: Makefile csh.c csh.h dir.c dol.c err.c exec.c extern.h
file.c func.c glob.c hist.c lex.c misc.c proc.c proc.h set.c str.c
time.c

Log Message:
WARNS=6 [-Wconversion]


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/Makefile
cvs rdiff -u -r1.45 -r1.46 src/bin/csh/csh.c
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/csh.h
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/dir.c src/bin/csh/file.c \
src/bin/csh/lex.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/dol.c src/bin/csh/exec.c \
src/bin/csh/extern.h
cvs rdiff -u -r1.20 -r1.21 src/bin/csh/err.c
cvs rdiff -u -r1.39 -r1.40 src/bin/csh/func.c
cvs rdiff -u -r1.26 -r1.27 src/bin/csh/glob.c
cvs rdiff -u -r1.19 -r1.20 src/bin/csh/hist.c src/bin/csh/misc.c \
src/bin/csh/time.c
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/proc.c
cvs rdiff -u -r1.13 -r1.14 src/bin/csh/proc.h
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/set.c
cvs rdiff -u -r1.14 -r1.15 src/bin/csh/str.c

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



CVS commit: src/bin/csh

2013-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 17:32:25 UTC 2013

Modified Files:
src/bin/csh: set.c

Log Message:
Make shifting variables reflect their environment counterparts. Makes
shift path work as expected.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/set.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/csh/set.c
diff -u src/bin/csh/set.c:1.31 src/bin/csh/set.c:1.32
--- src/bin/csh/set.c:1.31	Wed Jan 23 11:39:03 2013
+++ src/bin/csh/set.c	Wed Apr  3 13:32:24 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: set.c,v 1.31 2013/01/23 16:39:03 christos Exp $ */
+/* $NetBSD: set.c,v 1.32 2013/04/03 17:32:24 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)set.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: set.c,v 1.31 2013/01/23 16:39:03 christos Exp $);
+__RCSID($NetBSD: set.c,v 1.32 2013/04/03 17:32:24 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -65,6 +65,71 @@ static void balance(struct varent *, int
  * C Shell
  */
 
+static void
+update_vars(Char *vp)
+{
+if (eq(vp, STRpath)) {
+	struct varent *pt = adrof(STRpath); 
+	if (pt == NULL)
+	stderror(ERR_NAME | ERR_UNDVAR);
+	else {
+	exportpath(pt-vec);
+	dohash(NULL, NULL);
+	}
+}
+else if (eq(vp, STRhistchars)) {
+	Char *pn = value(STRhistchars);
+
+	HIST = *pn++;
+	HISTSUB = *pn;
+}
+else if (eq(vp, STRuser)) {
+	Setenv(STRUSER, value(vp));
+	Setenv(STRLOGNAME, value(vp));
+}
+else if (eq(vp, STRwordchars)) {
+	word_chars = value(vp);
+}
+else if (eq(vp, STRterm))
+	Setenv(STRTERM, value(vp));
+else if (eq(vp, STRhome)) {
+	Char *cp;
+
+	cp = Strsave(value(vp));	/* get the old value back */
+
+	/*
+	 * convert to canonical pathname (possibly resolving symlinks)
+	 */
+	cp = dcanon(cp, cp);
+
+	set(vp, Strsave(cp));	/* have to save the new val */
+
+	/* and now mirror home with HOME */
+	Setenv(STRHOME, cp);
+	/* fix directory stack for new tilde home */
+	dtilde();
+	xfree((ptr_t)cp);
+}
+#ifdef FILEC
+else if (eq(vp, STRfilec))
+	filec = 1;
+#endif
+#ifdef EDIT
+else if (eq(vp, STRedit)) {
+	HistEvent ev;
+	editing = 1;
+	el = el_init_fd(getprogname(), cshin, cshout, csherr,
+	SHIN, SHOUT, SHERR);
+	el_set(el, EL_EDITOR, emacs);
+	el_set(el, EL_PROMPT, printpromptstr);
+	hi = history_init();
+	history(hi, ev, H_SETSIZE, getn(value(STRhistory)));
+	loadhist(Histlist.Hnext);
+	el_set(el, EL_HIST, history, hi);
+}
+#endif
+}
+
 void
 /*ARGSUSED*/
 doset(Char **v, struct command *t)
@@ -128,66 +193,7 @@ doset(Char **v, struct command *t)
 	asx(vp, subscr, Strsave(p));
 	else
 	set(vp, Strsave(p));
-	if (eq(vp, STRpath)) {
-	struct varent *pt = adrof(STRpath); 
-	if (pt == NULL)
-		stderror(ERR_NAME | ERR_UNDVAR);
-	else {
-		exportpath(pt-vec);
-		dohash(NULL, NULL);
-	}
-	}
-	else if (eq(vp, STRhistchars)) {
-	Char *pn = value(STRhistchars);
-
-	HIST = *pn++;
-	HISTSUB = *pn;
-	}
-	else if (eq(vp, STRuser)) {
-	Setenv(STRUSER, value(vp));
-	Setenv(STRLOGNAME, value(vp));
-	}
-	else if (eq(vp, STRwordchars)) {
-	word_chars = value(vp);
-	}
-	else if (eq(vp, STRterm))
-	Setenv(STRTERM, value(vp));
-	else if (eq(vp, STRhome)) {
-	Char *cp;
-
-	cp = Strsave(value(vp));	/* get the old value back */
-
-	/*
-	 * convert to canonical pathname (possibly resolving symlinks)
-	 */
-	cp = dcanon(cp, cp);
-
-	set(vp, Strsave(cp));	/* have to save the new val */
-
-	/* and now mirror home with HOME */
-	Setenv(STRHOME, cp);
-	/* fix directory stack for new tilde home */
-	dtilde();
-	xfree((ptr_t)cp);
-	}
-#ifdef FILEC
-	else if (eq(vp, STRfilec))
-	filec = 1;
-#endif
-#ifdef EDIT
-	else if (eq(vp, STRedit)) {
-	HistEvent ev;
-	editing = 1;
-	el = el_init_fd(getprogname(), cshin, cshout, csherr,
-		SHIN, SHOUT, SHERR);
-	el_set(el, EL_EDITOR, emacs);
-	el_set(el, EL_PROMPT, printpromptstr);
-	hi = history_init();
-	history(hi, ev, H_SETSIZE, getn(value(STRhistory)));
-	loadhist(Histlist.Hnext);
-	el_set(el, EL_HIST, history, hi);
-	}
-#endif
+	update_vars(vp);
 } while ((p = *v++) != NULL);
 }
 
@@ -621,6 +627,7 @@ shift(Char **v, struct command *t)
 if (argv-vec[0] == 0)
 	stderror(ERR_NAME | ERR_NOMORE);
 lshift(argv-vec, 1);
+update_vars(name);
 }
 
 static void



CVS commit: src/bin/csh

2013-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr  3 17:32:25 UTC 2013

Modified Files:
src/bin/csh: set.c

Log Message:
Make shifting variables reflect their environment counterparts. Makes
shift path work as expected.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2013-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 25 14:20:58 UTC 2013

Modified Files:
src/bin/csh: Makefile

Log Message:
Obey SMALLPROG and don't enable the editor


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/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/csh/Makefile
diff -u src/bin/csh/Makefile:1.36 src/bin/csh/Makefile:1.37
--- src/bin/csh/Makefile:1.36	Wed Jan 23 11:39:03 2013
+++ src/bin/csh/Makefile	Fri Jan 25 09:20:57 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.36 2013/01/23 16:39:03 christos Exp $
+#	$NetBSD: Makefile,v 1.37 2013/01/25 14:20:57 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -14,7 +14,9 @@ DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_S
 #   should implement internally
 # - Does not handle escaped prompts.
 # - Does not do completion
+.ifndef SMALLPROG
 DFLAGS+=-DEDIT
+.endif
 CPPFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \



CVS commit: src/bin/csh

2013-01-25 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri Jan 25 19:07:15 UTC 2013

Modified Files:
src/bin/csh: Makefile

Log Message:
When using -ledit, also use -lterminfo, to allow static linking.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/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/csh/Makefile
diff -u src/bin/csh/Makefile:1.37 src/bin/csh/Makefile:1.38
--- src/bin/csh/Makefile:1.37	Fri Jan 25 14:20:57 2013
+++ src/bin/csh/Makefile	Fri Jan 25 19:07:14 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.37 2013/01/25 14:20:57 christos Exp $
+#	$NetBSD: Makefile,v 1.38 2013/01/25 19:07:14 he Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -64,7 +64,7 @@ COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 
 .if !empty(DFLAGS:M*EDIT)
-LDADD+=-ledit -lutil
+LDADD+=-ledit -lterminfo -lutil
 DPADD+=${LIBEDIT} ${LIBUTIL}
 .else
 LDADD+=-lutil



CVS commit: src/bin/csh

2013-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 25 14:20:58 UTC 2013

Modified Files:
src/bin/csh: Makefile

Log Message:
Obey SMALLPROG and don't enable the editor


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/csh/Makefile

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



CVS commit: src/bin/csh

2013-01-25 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Fri Jan 25 19:07:15 UTC 2013

Modified Files:
src/bin/csh: Makefile

Log Message:
When using -ledit, also use -lterminfo, to allow static linking.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/csh/Makefile

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



CVS commit: src/bin/csh

2013-01-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 23 16:39:04 UTC 2013

Modified Files:
src/bin/csh: Makefile csh.c csh.h extern.h hist.c lex.c set.c

Log Message:
make history kind of work :-), turn libedit support on.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/Makefile
cvs rdiff -u -r1.44 -r1.45 src/bin/csh/csh.c
cvs rdiff -u -r1.24 -r1.25 src/bin/csh/csh.h
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/extern.h
cvs rdiff -u -r1.18 -r1.19 src/bin/csh/hist.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/lex.c
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/set.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/csh/Makefile
diff -u src/bin/csh/Makefile:1.35 src/bin/csh/Makefile:1.36
--- src/bin/csh/Makefile:1.35	Tue Jan 22 17:40:31 2013
+++ src/bin/csh/Makefile	Wed Jan 23 11:39:03 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.35 2013/01/22 22:40:31 christos Exp $
+#	$NetBSD: Makefile,v 1.36 2013/01/23 16:39:03 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -10,10 +10,11 @@
 
 PROG=	csh
 DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
-# - Not integrated with history
+# - Editor history not always aligned with shell history,
+#   should implement internally
 # - Does not handle escaped prompts.
 # - Does not do completion
-# DFLAGS+=-DEDIT
+DFLAGS+=-DEDIT
 CPPFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
@@ -60,7 +61,7 @@ COPTS.err.c = -Wno-format-nonliteral
 COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 
-.if 0
+.if !empty(DFLAGS:M*EDIT)
 LDADD+=-ledit -lutil
 DPADD+=${LIBEDIT} ${LIBUTIL}
 .else

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.44 src/bin/csh/csh.c:1.45
--- src/bin/csh/csh.c:1.44	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/csh.c	Wed Jan 23 11:39:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.44 2013/01/22 20:35:29 christos Exp $ */
+/* $NetBSD: csh.c,v 1.45 2013/01/23 16:39:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)csh.c	8.2 (Berkeley) 10/12/93;
 #else
-__RCSID($NetBSD: csh.c,v 1.44 2013/01/22 20:35:29 christos Exp $);
+__RCSID($NetBSD: csh.c,v 1.45 2013/01/23 16:39:03 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -78,7 +78,7 @@ __RCSID($NetBSD: csh.c,v 1.44 2013/01/2
  */
 
 Char *dumphist[] = {STRhistory, STRmh, 0, 0};
-Char *loadhist[] = {STRsource, STRmh, STRtildothist, 0};
+Char *tildehist[] = {STRsource, STRmh, STRtildothist, 0};
 
 int nofile = 0;
 int batch = 0;
@@ -542,8 +542,8 @@ notty:
 	 * Source history before .login so that it is available in .login
 	 */
 	if ((cp = value(STRhistfile)) != STRNULL)
-	loadhist[2] = cp;
-	dosource(loadhist, NULL);
+	tildehist[2] = cp;
+	dosource(tildehist, NULL);
 if (loginsh)
 	  (void)srccat(value(STRhome), STRsldotlogin);
 }

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.24 src/bin/csh/csh.h:1.25
--- src/bin/csh/csh.h:1.24	Tue Jan 22 17:40:31 2013
+++ src/bin/csh/csh.h	Wed Jan 23 11:39:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.24 2013/01/22 22:40:31 christos Exp $ */
+/* $NetBSD: csh.h,v 1.25 2013/01/23 16:39:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -552,6 +552,7 @@ Char **STR_environ;
 #ifdef EDIT
 #include histedit.h
 EditLine *el;
+History *hi;
 #endif
 int editing;
 

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.27 src/bin/csh/extern.h:1.28
--- src/bin/csh/extern.h:1.27	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/extern.h	Wed Jan 23 11:39:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.27 2013/01/22 20:35:29 christos Exp $ */
+/* $NetBSD: extern.h,v 1.28 2013/01/23 16:39:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -175,6 +175,9 @@ int sortscmp(const ptr_t, const ptr_t);
  */
 void dohist(Char **, struct command *);
 struct Hist *enthist(int, struct wordent *, int);
+#ifdef EDIT
+void loadhist(struct Hist *);
+#endif
 void savehist(struct wordent *);
 
 /*
@@ -189,6 +192,9 @@ Char *domod(Char *, int);
 void freelex(struct wordent *);
 int lex(struct wordent *);
 void prlex(FILE *, struct wordent *);
+#ifdef EDIT
+int sprlex(char **, struct wordent *);
+#endif
 int readc(int);
 void settell(void);
 void unreadc(int);

Index: src/bin/csh/hist.c
diff -u src/bin/csh/hist.c:1.18 src/bin/csh/hist.c:1.19
--- src/bin/csh/hist.c:1.18	Mon Jul 16 14:26:10 2007
+++ src/bin/csh/hist.c	Wed Jan 23 11:39:03 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: hist.c,v 1.18 2007/07/16 18:26:10 christos Exp $ */
+/* $NetBSD: hist.c,v 1.19 2013/01/23 16:39:03 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)hist.c	8.1 (Berkeley) 5/31/93;
 #else

CVS commit: src/bin/csh

2013-01-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan 23 16:39:04 UTC 2013

Modified Files:
src/bin/csh: Makefile csh.c csh.h extern.h hist.c lex.c set.c

Log Message:
make history kind of work :-), turn libedit support on.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/bin/csh/Makefile
cvs rdiff -u -r1.44 -r1.45 src/bin/csh/csh.c
cvs rdiff -u -r1.24 -r1.25 src/bin/csh/csh.h
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/extern.h
cvs rdiff -u -r1.18 -r1.19 src/bin/csh/hist.c
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/lex.c
cvs rdiff -u -r1.30 -r1.31 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 19:28:01 UTC 2013

Modified Files:
src/bin/csh: alloc.c csh.1 extern.h init.c

Log Message:
Remove alloc builtin, it did not work anyway since most modern malloc
implementation use a combination of sbrk/mmap.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/csh/alloc.c
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.1
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/extern.h
cvs rdiff -u -r1.10 -r1.11 src/bin/csh/init.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/csh/alloc.c
diff -u src/bin/csh/alloc.c:1.12 src/bin/csh/alloc.c:1.13
--- src/bin/csh/alloc.c:1.12	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/alloc.c	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.12 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)alloc.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: alloc.c,v 1.12 2003/08/07 09:05:03 agc Exp $);
+__RCSID($NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -47,16 +47,11 @@ __RCSID($NetBSD: alloc.c,v 1.12 2003/08
 #include csh.h
 #include extern.h
 
-char *memtop = NULL;		/* PWP: top of current memory */
-char *membot = NULL;		/* PWP: bottom of allocatable memory */
-
 ptr_t
 Malloc(size_t n)
 {
 ptr_t ptr;
 
-if (membot == NULL)
-	memtop = membot = sbrk(0);
 if ((ptr = malloc(n)) == (ptr_t) 0) {
 	child++;
 	stderror(ERR_NOMEM);
@@ -69,8 +64,6 @@ Realloc(ptr_t p, size_t n)
 {
 ptr_t ptr;
 
-if (membot == NULL)
-	memtop = membot = sbrk(0);
 if ((ptr = realloc(p, n)) == (ptr_t) 0) {
 	child++;
 	stderror(ERR_NOMEM);
@@ -83,8 +76,6 @@ Calloc(size_t s, size_t n)
 {
 ptr_t ptr;
 
-if (membot == NULL)
-	memtop = membot = sbrk(0);
 if ((ptr = calloc(s, n)) == (ptr_t) 0) {
 	child++;
 	stderror(ERR_NOMEM);
@@ -98,20 +89,3 @@ Free(ptr_t p)
 if (p)
 	free(p);
 }
-
-/*
- * mstats - print out statistics about malloc
- *
- * Prints two lines of numbers, one showing the length of the free list
- * for each size category, the second showing the number of mallocs -
- * frees for each size category.
- */
-void
-/*ARGSUSED*/
-showall(Char **v, struct command *t)
-{
-memtop = (char *)sbrk(0);
-(void)fprintf(cshout, Allocated memory from 0x%lx to 0x%lx (%ld).\n,
-	(unsigned long)membot, (unsigned long)memtop, 
-	(unsigned long)(memtop - membot));
-}

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.50 src/bin/csh/csh.1:1.51
--- src/bin/csh/csh.1:1.50	Thu Mar 22 03:58:16 2012
+++ src/bin/csh/csh.1	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: csh.1,v 1.50 2012/03/22 07:58:16 wiz Exp $
+.\	$NetBSD: csh.1,v 1.51 2013/01/22 19:28:00 christos Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -1095,15 +1095,6 @@ is not allowed to be
 or
 .Ar unalias .
 .Pp
-.It Ic alloc
-Shows the amount of dynamic memory acquired, broken down into used and
-free memory.
-With an argument shows the number of free and used blocks in each size
-category.
-The categories start at size 8 and double at each step.
-This command's output may vary across system types, since
-systems other than the VAX may use a different memory allocator.
-.Pp
 .It Ic bg
 .It Ic bg \% Ns Ar job ...
 Puts the current or specified jobs into the background, continuing them

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.25 src/bin/csh/extern.h:1.26
--- src/bin/csh/extern.h:1.25	Thu Dec 27 16:19:20 2012
+++ src/bin/csh/extern.h	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.25 2012/12/27 21:19:20 christos Exp $ */
+/* $NetBSD: extern.h,v 1.26 2013/01/22 19:28:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -301,7 +301,6 @@ void Free(ptr_t);
 ptr_t Malloc(size_t);
 ptr_t Realloc(ptr_t, size_t);
 ptr_t Calloc(size_t, size_t);
-void showall(Char **, struct command *);
 
 /*
  * str.c:

Index: src/bin/csh/init.c
diff -u src/bin/csh/init.c:1.10 src/bin/csh/init.c:1.11
--- src/bin/csh/init.c:1.10	Thu Aug  7 05:05:06 2003
+++ src/bin/csh/init.c	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.10 2003/08/07 09:05:06 agc Exp $ */
+/* $NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)init.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: init.c,v 1.10 2003/08/07 09:05:06 agc Exp $);
+__RCSID($NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,6 @@ struct biltins bfunc[] =
 {
 { @, 		dolet, 		0, INF	},
 { alias, 		doalias, 	0, INF	},
-{ alloc, 		showall, 	0, 1	},
 { bg, 		dobg, 		0, INF	},
 { break, 		dobreak, 	0, 

CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 20:35:29 UTC 2013

Modified Files:
src/bin/csh: Makefile const.c csh.c csh.h extern.h glob.c lex.c set.c

Log Message:
Add a little libedit front end. Could be used as someone's pet project to
learn how to program. It is not enabled in the Makefile, and it states why
there.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/Makefile
cvs rdiff -u -r1.9 -r1.10 src/bin/csh/const.c
cvs rdiff -u -r1.43 -r1.44 src/bin/csh/csh.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/csh.h
cvs rdiff -u -r1.26 -r1.27 src/bin/csh/extern.h
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/glob.c
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/lex.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/set.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/csh/Makefile
diff -u src/bin/csh/Makefile:1.33 src/bin/csh/Makefile:1.34
--- src/bin/csh/Makefile:1.33	Sun Aug 28 03:49:16 2011
+++ src/bin/csh/Makefile	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2011/08/28 07:49:16 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2013/01/22 20:35:29 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -10,6 +10,10 @@
 
 PROG=	csh
 DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
+# - Not integrated with history
+# - Does not handle escaped prompts.
+# - Does not do completion
+# DFLAGS+=-DEDIT
 CPPFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
@@ -56,8 +60,13 @@ COPTS.err.c = -Wno-format-nonliteral
 COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 
+.if 0
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
+.elese
+LDADD+=-ledit -lutil
+DPADD+=${LIBEDIT} ${LIBUTIL}
+.endif
 
 .include bsd.prog.mk
 .include bsd.subdir.mk

Index: src/bin/csh/const.c
diff -u src/bin/csh/const.c:1.9 src/bin/csh/const.c:1.10
--- src/bin/csh/const.c:1.9	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/const.c	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: const.c,v 1.9 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: const.c,v 1.10 2013/01/22 20:35:29 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)const.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: const.c,v 1.9 2003/08/07 09:05:03 agc Exp $);
+__RCSID($NetBSD: const.c,v 1.10 2013/01/22 20:35:29 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -83,6 +83,7 @@ Char STRdot[]   = { '.', '\0' };
 Char STRdotdotsl[]	= { '.', '.', '/', '\0' };
 Char STRdotsl[]		= { '.', '/', '\0' };
 Char STRecho[]  = { 'e', 'c', 'h', 'o', '\0' };
+Char STRedit[]  = { 'e', 'd', 'i', 't', '\0' };
 Char STRequal[]		= { '=', '\0' };
 Char STRfakecom[]	= { '{', ' ', '.', '.', '.', ' ', '}', '\0' };
 Char STRfakecom1[]	= { '`', ' ', '.', '.', '.', ' ', '`', '\0' };

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.43 src/bin/csh/csh.c:1.44
--- src/bin/csh/csh.c:1.43	Sun Jan 22 13:36:14 2012
+++ src/bin/csh/csh.c	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.43 2012/01/22 18:36:14 christos Exp $ */
+/* $NetBSD: csh.c,v 1.44 2013/01/22 20:35:29 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)csh.c	8.2 (Berkeley) 10/12/93;
 #else
-__RCSID($NetBSD: csh.c,v 1.43 2012/01/22 18:36:14 christos Exp $);
+__RCSID($NetBSD: csh.c,v 1.44 2013/01/22 20:35:29 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -105,8 +105,9 @@ static void mailchk(void);
 #ifndef _PATH_DEFPATH
 static Char **defaultpath(void);
 #endif
-
-int main(int, char *[]);
+#ifdef EDITING
+int	editing = 0;
+#endif
 
 int
 main(int argc, char *argv[])
@@ -1341,6 +1342,9 @@ printprompt(void)
 {
 Char *cp;
 
+if (editing)
+	return;
+
 if (!whyles) {
 	for (cp = value(STRprompt); *cp; cp++)
 	if (*cp == HIST)
@@ -1358,3 +1362,30 @@ printprompt(void)
 	(void)fprintf(cshout, ? );
 (void)fflush(cshout);
 }
+
+#ifdef EDIT
+char *
+printpromptstr(EditLine *elx) {
+static char pbuf[1024];
+static char qspace[] = ? ;
+Char *cp;
+size_t i;
+
+if (whyles)
+	return qspace;
+
+i = 0;
+for (cp = value(STRprompt); *cp; cp++) {
+	if (i = sizeof(pbuf))
+	break;
+	if (*cp == HIST)
+	i += snprintf(pbuf + i, sizeof(pbuf) - i, %d, eventno + 1);
+	else
+	pbuf[i++] = *cp;
+}
+if (i = sizeof(pbuf))
+	i = sizeof(pbuf) - 1;
+pbuf[i] = '\0';
+return pbuf;
+}
+#endif

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.22 src/bin/csh/csh.h:1.23
--- src/bin/csh/csh.h:1.22	Wed Nov  9 14:16:00 2011
+++ src/bin/csh/csh.h	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.22 2011/11/09 19:16:00 christos Exp $ */
+/* $NetBSD: csh.h,v 1.23 

CVS commit: src/bin/csh

2013-01-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan 22 21:20:27 UTC 2013

Modified Files:
src/bin/csh: csh.1

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/csh/csh.1

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

Modified files:

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.51 src/bin/csh/csh.1:1.52
--- src/bin/csh/csh.1:1.51	Tue Jan 22 19:28:00 2013
+++ src/bin/csh/csh.1	Tue Jan 22 21:20:26 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: csh.1,v 1.51 2013/01/22 19:28:00 christos Exp $
+.\	$NetBSD: csh.1,v 1.52 2013/01/22 21:20:26 wiz Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)csh.1	8.2 (Berkeley) 1/21/94
 .\
-.Dd March 29, 2009
+.Dd January 22, 2013
 .Dt CSH 1
 .Os
 .Sh NAME



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 22:40:31 UTC 2013

Modified Files:
src/bin/csh: Makefile csh.h

Log Message:
fix compilation without -DEDIT


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/Makefile
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/csh.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/csh/Makefile
diff -u src/bin/csh/Makefile:1.34 src/bin/csh/Makefile:1.35
--- src/bin/csh/Makefile:1.34	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/Makefile	Tue Jan 22 17:40:31 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2013/01/22 20:35:29 christos Exp $
+#	$NetBSD: Makefile,v 1.35 2013/01/22 22:40:31 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -61,11 +61,11 @@ COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 
 .if 0
-LDADD+=-lutil
-DPADD+=${LIBUTIL}
-.elese
 LDADD+=-ledit -lutil
 DPADD+=${LIBEDIT} ${LIBUTIL}
+.else
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
 .endif
 
 .include bsd.prog.mk

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.23 src/bin/csh/csh.h:1.24
--- src/bin/csh/csh.h:1.23	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/csh.h	Tue Jan 22 17:40:31 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.23 2013/01/22 20:35:29 christos Exp $ */
+/* $NetBSD: csh.h,v 1.24 2013/01/22 22:40:31 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -552,7 +552,7 @@ Char **STR_environ;
 #ifdef EDIT
 #include histedit.h
 EditLine *el;
-int editing;
 #endif
+int editing;
 
 #endif /* !_CSH_H_ */



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 19:28:01 UTC 2013

Modified Files:
src/bin/csh: alloc.c csh.1 extern.h init.c

Log Message:
Remove alloc builtin, it did not work anyway since most modern malloc
implementation use a combination of sbrk/mmap.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/csh/alloc.c
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.1
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/extern.h
cvs rdiff -u -r1.10 -r1.11 src/bin/csh/init.c

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



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 20:35:29 UTC 2013

Modified Files:
src/bin/csh: Makefile const.c csh.c csh.h extern.h glob.c lex.c set.c

Log Message:
Add a little libedit front end. Could be used as someone's pet project to
learn how to program. It is not enabled in the Makefile, and it states why
there.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/Makefile
cvs rdiff -u -r1.9 -r1.10 src/bin/csh/const.c
cvs rdiff -u -r1.43 -r1.44 src/bin/csh/csh.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/csh.h
cvs rdiff -u -r1.26 -r1.27 src/bin/csh/extern.h
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/glob.c
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/lex.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/set.c

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



CVS commit: src/bin/csh

2013-01-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan 22 21:20:27 UTC 2013

Modified Files:
src/bin/csh: csh.1

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/csh/csh.1

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



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 22:40:31 UTC 2013

Modified Files:
src/bin/csh: Makefile csh.h

Log Message:
fix compilation without -DEDIT


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/Makefile
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/csh.h

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



CVS commit: src/bin/csh

2012-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Dec 27 21:19:20 UTC 2012

Modified Files:
src/bin/csh: extern.h str.c

Log Message:
sprinkle const, no functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/csh/extern.h
cvs rdiff -u -r1.13 -r1.14 src/bin/csh/str.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/csh/extern.h
diff -u src/bin/csh/extern.h:1.24 src/bin/csh/extern.h:1.25
--- src/bin/csh/extern.h:1.24	Wed Nov  9 14:16:01 2011
+++ src/bin/csh/extern.h	Thu Dec 27 16:19:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.24 2011/11/09 19:16:01 christos Exp $ */
+/* $NetBSD: extern.h,v 1.25 2012/12/27 21:19:20 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -307,27 +307,27 @@ void showall(Char **, struct command *);
  * str.c:
  */
 #ifdef SHORT_STRINGS
-Char *s_strchr(Char *, int);
-Char *s_strrchr(Char *, int);
-Char *s_strcat(Char *, Char *);
+Char *s_strchr(const Char *, int);
+Char *s_strrchr(const Char *, int);
+Char *s_strcat(Char *, const Char *);
 #ifdef NOTUSED
-Char *s_strncat(Char *, Char *, size_t);
+Char *s_strncat(Char *, const Char *, size_t);
 #endif
-Char *s_strcpy(Char *, Char *);
-Char *s_strncpy(Char *, Char *, size_t);
-Char *s_strspl(Char *, Char *);
-size_t s_strlen(Char *);
-int s_strcmp(Char *, Char *);
-int s_strncmp(Char *, Char *, size_t);
-Char *s_strsave(Char *);
-Char *s_strend(Char *);
-Char *s_strstr(Char *, Char *);
+Char *s_strcpy(Char *, const Char *);
+Char *s_strncpy(Char *, const Char *, size_t);
+Char *s_strspl(const Char *, const Char *);
+size_t s_strlen(const Char *);
+int s_strcmp(const Char *, const Char *);
+int s_strncmp(const Char *, const Char *, size_t);
+Char *s_strsave(const Char *);
+Char *s_strend(const Char *);
+Char *s_strstr(const Char *, const Char *);
 Char *str2short(const char *);
 Char **blk2short(char **);
-char *short2str(Char *);
-char **short2blk(Char **);
+char *short2str(const Char *);
+char **short2blk(Char * const *);
 #endif
-char *short2qstr(Char *);
-char *vis_str(Char *);
+char *short2qstr(const Char *);
+char *vis_str(const Char *);
 
 #endif /* !_EXTERN_H_ */

Index: src/bin/csh/str.c
diff -u src/bin/csh/str.c:1.13 src/bin/csh/str.c:1.14
--- src/bin/csh/str.c:1.13	Thu Aug  7 05:05:07 2003
+++ src/bin/csh/str.c	Thu Dec 27 16:19:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.13 2003/08/07 09:05:07 agc Exp $ */
+/* $NetBSD: str.c,v 1.14 2012/12/27 21:19:20 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)str.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: str.c,v 1.13 2003/08/07 09:05:07 agc Exp $);
+__RCSID($NetBSD: str.c,v 1.14 2012/12/27 21:19:20 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -75,7 +75,7 @@ blk2short(char **src)
 }
 
 char **
-short2blk(Char **src)
+short2blk(Char *const *src)
 {
 char **dst, **sdst;
 size_t n;
@@ -125,7 +125,7 @@ str2short(const char *src)
 }
 
 char *
-short2str(Char *src)
+short2str(const Char *src)
 {
 static char *sdst = NULL;
 static size_t dstsize = 0;
@@ -155,7 +155,7 @@ short2str(Char *src)
 }
 
 Char *
-s_strcpy(Char *dst, Char *src)
+s_strcpy(Char *dst, const Char *src)
 {
 Char *sdst;
 
@@ -166,7 +166,7 @@ s_strcpy(Char *dst, Char *src)
 }
 
 Char *
-s_strncpy(Char *dst, Char *src, size_t n)
+s_strncpy(Char *dst, const Char *src, size_t n)
 {
 Char *sdst;
 
@@ -185,7 +185,7 @@ s_strncpy(Char *dst, Char *src, size_t n
 }
 
 Char *
-s_strcat(Char *dst, Char *src)
+s_strcat(Char *dst, const Char *src)
 {
 short *sdst;
 
@@ -226,30 +226,30 @@ s_strncat(Char *dst, Char *src, size_t n
 #endif
 
 Char *
-s_strchr(Char *str, int ch)
+s_strchr(const Char *str, int ch)
 {
 do
 	if (*str == ch)
-	return (str);
+	return __UNCONST(str);
 while (*str++);
 return (NULL);
 }
 
 Char *
-s_strrchr(Char *str, int ch)
+s_strrchr(const Char *str, int ch)
 {
-Char *rstr;
+const Char *rstr;
 
 rstr = NULL;
 do
 	if (*str == ch)
 	rstr = str;
 while (*str++);
-return (rstr);
+return __UNCONST(rstr);
 }
 
 size_t
-s_strlen(Char *str)
+s_strlen(const Char *str)
 {
 size_t n;
 
@@ -259,7 +259,7 @@ s_strlen(Char *str)
 }
 
 int
-s_strcmp(Char *str1, Char *str2)
+s_strcmp(const Char *str1, const Char *str2)
 {
 for (; *str1  *str1 == *str2; str1++, str2++)
 	continue;
@@ -279,7 +279,7 @@ s_strcmp(Char *str1, Char *str2)
 }
 
 int
-s_strncmp(Char *str1, Char *str2, size_t n)
+s_strncmp(const Char *str1, const Char *str2, size_t n)
 {
 if (n == 0)
 	return (0);
@@ -305,24 +305,26 @@ s_strncmp(Char *str1, Char *str2, size_t
 }
 
 Char *
-s_strsave(Char *s)
+s_strsave(const Char *s)
 {
-Char *n, *p;
+const Char *p;
+Char *n;
 
 if (s == 0)
 	s = STRNULL;
 for (p = s; *p++;)
 	continue;
-n = p = (Char *)xmalloc((size_t)((p - s) * sizeof(Char)));
-while 

CVS commit: src/bin/csh

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

Modified Files:
src/bin/csh: func.c

Log Message:
support RLIMIT_NTHR


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/func.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/csh/func.c
diff -u src/bin/csh/func.c:1.38 src/bin/csh/func.c:1.39
--- src/bin/csh/func.c:1.38	Wed Aug 31 12:24:54 2011
+++ src/bin/csh/func.c	Fri Jun  8 22:50:43 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: func.c,v 1.38 2011/08/31 16:24:54 plunky Exp $ */
+/* $NetBSD: func.c,v 1.39 2012/06/09 02:50:43 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)func.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: func.c,v 1.38 2011/08/31 16:24:54 plunky Exp $);
+__RCSID($NetBSD: func.c,v 1.39 2012/06/09 02:50:43 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -1104,6 +1104,7 @@ static const struct limits {
 { RLIMIT_RSS,	memoryuse,	1024,	kbytes },
 { RLIMIT_MEMLOCK,	memorylocked,	1024,	kbytes },
 { RLIMIT_NPROC,	maxproc,	1,	 },
+{ RLIMIT_NTHR,	maxthread,	1,	 },
 { RLIMIT_NOFILE,	openfiles,	1,	 },
 { RLIMIT_SBSIZE,	sbsize,	1,	bytes },
 { RLIMIT_AS,	vmemoryuse,	1024,	kbytes },



CVS commit: src/bin/csh

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

Modified Files:
src/bin/csh: func.c

Log Message:
support RLIMIT_NTHR


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/bin/csh/func.c

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



CVS commit: src/bin/csh

2012-01-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 19 02:42:53 UTC 2012

Modified Files:
src/bin/csh: char.c char.h

Log Message:
PR/45856: Bernhard Burnhard Riedel: Infinite loop on nbsp; input. Sending
char 160 in the input to csh, lead it to an infinite loop, because tcsh tables
counted this as a space character, but the word logic switch does not. Change
that character tables, so that this does not count as a spacing character
anymore, by syncing the table with the one from tcsh.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/csh/char.c
cvs rdiff -u -r1.8 -r1.9 src/bin/csh/char.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/csh/char.c
diff -u src/bin/csh/char.c:1.9 src/bin/csh/char.c:1.10
--- src/bin/csh/char.c:1.9	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/char.c	Wed Jan 18 21:42:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: char.c,v 1.9 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: char.c,v 1.10 2012/01/19 02:42:53 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,209 +34,210 @@
 #if 0
 static char sccsid[] = @(#)char.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: char.c,v 1.9 2003/08/07 09:05:03 agc Exp $);
+__RCSID($NetBSD: char.c,v 1.10 2012/01/19 02:42:53 christos Exp $);
 #endif
 #endif /* not lint */
 
 #include char.h
 
+/* on default same as original map */
 unsigned short _cmap[256] = {
-/*	nul		soh		stx		etx	*/
+/*	  0 nul		  1 soh		  2 stx		  3 etx	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	eot		enq		ack		bel	*/
+/*	  4 eot		  5 enq		  6 ack		  7 bel	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	bs		ht		nl		vt	*/
+/*	  8 bs		  9 ht		 10 nl		 11 vt	*/
 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
 
-/*	np		cr		so		si	*/
+/*	 12 np		 13 cr		 14 so		 15 si	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	dle		dc1		dc2		dc3	*/
+/*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	dc4		nak		syn		etb	*/
+/*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	can		em		sub		esc	*/
+/*	 24 can		 25 em		 26 sub		 27 esc	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	fs		gs		rs		us	*/
+/*	 28 fs		 29 gs		 30 rs		 31 us	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	sp		!#	*/
-	_SP|_META,	0,		_QF,		_META,
+/*	 32 sp		 33 !		 34 		 35 #	*/
+	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
 
-/*	$		%'	*/
-	_DOL,		0,		_META|_CMD,	_QF,
+/*	 36 $		 37 %		 38 		 39 '	*/
+	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
 
-/*	(		)		*		+	*/
-	_META|_CMD,	_META,		_GLOB,		0,
+/*	 40 (		 41 )		 42 *		 43 +	*/
+	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
 
-/*	,		-		.		/	*/
-	0,		0,		0,		0,
+/*	 44 ,		 45 -		 46 .		 47 /	*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	0		1		2		3	*/
+/*	 48 0		 49 1		 50 2		 51 3	*/
 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
 
-/*	4		5		6		7	*/
+/*	 52 4		 53 5		 54 6		 55 7	*/
 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
 
-/*	8		9		:		;	*/
-	_DIG|_XD,	_DIG|_XD,	0,		_META|_CMD,
+/*	 56 8		 57 9		 58 :		 59 ;	*/
+	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
 
-/*			=?	*/
-	_META,		0,		_META,		_GLOB,
+/*	 60 		 61 =		 62 		 63 ?	*/
+	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
 
-/*	@		A		B		C	*/
-	0,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
+/*	 64 @		 65 A		 66 B		 67 C	*/
+	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
 
-/*	D		E		F		G	*/
+/*	 68 D		 69 E		 70 F		 71 G	*/
 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
 
-/*	H		I		J		K	*/
+/*	 72 H		 73 I		 74 J		 75 K	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	L		M		N		O	*/
+/*	 76 L		 77 M		 78 N		 79 O	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	P		Q		R		S	*/
+/*	 80 P		 81 Q		 82 R		 83 S	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	T		U		V		W	*/
+/*	 84 T		 85 U		 86 V		 87 W	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	X		Y		Z		[	*/
-	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB,
+/*	 88 X		 89 Y		 90 Z		 91 [	*/
+	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
 
-/*	\		]		^		_	*/
-	_ESC,		0,		0,		0,
+/*	 92 \		 93 ]		 94 ^		 95 _	*/
+	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
 
-/*	`		a		b		c	*/
-  _QB|_GLOB|_META,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,
+/*	 96 `		 97 a		 98 b		 99 c	*/
+  _QB|_GLOB|_META|_PUN,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,
 
-/*	d		e		f		g	*/
+/*	100 d		101 e		102 f		103 g	*/
 	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW,
 
-/*	h		i		j		k	*/
+/*	104 h		105 i		106 j		107 k	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	l		m		n		o	*/
+/*	108 l		109 m		110 n		111 o	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	p		q		r		s	*/
+/*	112 p		113 q		114 r		115 s	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	t		u		v		w	*/
+/*	116 t		117 u		118 v		119 w	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	x		y		z		{	*/
-	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_GLOB,
+/*	120 x		121 y		122 z		123 {	*/
+	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_GLOB|_PUN,
 
-/*	|		}		~		del	*/
-	_META|_CMD,	0,		0,		_CTR,
+/*	124 

CVS commit: src/bin/csh

2012-01-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan 19 02:42:53 UTC 2012

Modified Files:
src/bin/csh: char.c char.h

Log Message:
PR/45856: Bernhard Burnhard Riedel: Infinite loop on nbsp; input. Sending
char 160 in the input to csh, lead it to an infinite loop, because tcsh tables
counted this as a space character, but the word logic switch does not. Change
that character tables, so that this does not count as a spacing character
anymore, by syncing the table with the one from tcsh.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/csh/char.c
cvs rdiff -u -r1.8 -r1.9 src/bin/csh/char.h

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



CVS commit: src/bin/csh

2011-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  9 19:16:01 UTC 2011

Modified Files:
src/bin/csh: csh.h dol.c extern.h proc.c proc.h time.c

Log Message:
sync with /usr/bin/time, use CLOCK_MONOTONIC


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/csh.h
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/dol.c
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/extern.h
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/proc.c
cvs rdiff -u -r1.12 -r1.13 src/bin/csh/proc.h
cvs rdiff -u -r1.18 -r1.19 src/bin/csh/time.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/csh/csh.h
diff -u src/bin/csh/csh.h:1.21 src/bin/csh/csh.h:1.22
--- src/bin/csh/csh.h:1.21	Mon Jul 16 14:26:09 2007
+++ src/bin/csh/csh.h	Wed Nov  9 14:16:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.21 2007/07/16 18:26:09 christos Exp $ */
+/* $NetBSD: csh.h,v 1.22 2011/11/09 19:16:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -141,7 +141,7 @@ Char *shtemp;			/* Temp name for  shel
 #include sys/time.h
 #include sys/types.h
 
-struct timeval time0;		/* Time at which the shell started */
+struct timespec time0;		/* Time at which the shell started */
 struct rusage ru0;
 
 /*

Index: src/bin/csh/dol.c
diff -u src/bin/csh/dol.c:1.27 src/bin/csh/dol.c:1.28
--- src/bin/csh/dol.c:1.27	Mon Aug 29 10:51:17 2011
+++ src/bin/csh/dol.c	Wed Nov  9 14:16:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: dol.c,v 1.27 2011/08/29 14:51:17 joerg Exp $ */
+/* $NetBSD: dol.c,v 1.28 2011/11/09 19:16:01 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)dol.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: dol.c,v 1.27 2011/08/29 14:51:17 joerg Exp $);
+__RCSID($NetBSD: dol.c,v 1.28 2011/11/09 19:16:01 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -815,7 +815,7 @@ void
 heredoc(Char *term)
 {
 Char obuf[BUFSIZE], lbuf[BUFSIZE], mbuf[BUFSIZE];
-struct timeval tv;
+struct timespec tv;
 Char *Dv[2], *lbp, *obp, *mbp, **vp;
 char *tmp;
 int c, ocnt, lcnt, mcnt;
@@ -826,9 +826,9 @@ again:
 if (open(tmp, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)  0) {
 	if (errno == EEXIST) {
 	if (unlink(tmp) == -1) {
-		(void)gettimeofday(tv, NULL);
+		(void)clock_gettime(CLOCK_MONOTONIC, tv);
 		mbp = putnint)tv.tv_sec) ^ 
-		((int)tv.tv_usec) ^ ((int)getpid()))  0x00ff);
+		((int)tv.tv_nsec) ^ ((int)getpid()))  0x00ff);
 		shtemp = Strspl(STRtmpsh, mbp);
 		xfree((ptr_t)mbp);
 	}

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.23 src/bin/csh/extern.h:1.24
--- src/bin/csh/extern.h:1.23	Mon Aug 29 10:51:17 2011
+++ src/bin/csh/extern.h	Wed Nov  9 14:16:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.23 2011/08/29 14:51:17 joerg Exp $ */
+/* $NetBSD: extern.h,v 1.24 2011/11/09 19:16:01 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -288,8 +288,8 @@ void plist(struct varent *);
  */
 void donice(Char **, struct command *);
 void dotime(Char **, struct command *);
-void prusage(FILE *, struct rusage *, struct rusage *, struct timeval *,
- struct timeval *);
+void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
+ struct timespec *);
 void ruadd(struct rusage *, struct rusage *);
 void settimes(void);
 void psecs(long);

Index: src/bin/csh/proc.c
diff -u src/bin/csh/proc.c:1.34 src/bin/csh/proc.c:1.35
--- src/bin/csh/proc.c:1.34	Mon Jul 16 14:26:10 2007
+++ src/bin/csh/proc.c	Wed Nov  9 14:16:01 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.c,v 1.34 2007/07/16 18:26:10 christos Exp $ */
+/* $NetBSD: proc.c,v 1.35 2011/11/09 19:16:01 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)proc.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: proc.c,v 1.34 2007/07/16 18:26:10 christos Exp $);
+__RCSID($NetBSD: proc.c,v 1.35 2011/11/09 19:16:01 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -109,7 +109,7 @@ found:
 }
 else {
 	if (pp-p_flags  (PTIME | PPTIME) || adrof(STRtime))
-	(void)gettimeofday(pp-p_etime, NULL);
+	(void)clock_gettime(CLOCK_MONOTONIC, pp-p_etime);
 
 	pp-p_rusage = ru;
 	if (WIFSIGNALED(w)) {
@@ -500,7 +500,7 @@ palloc(int pid, struct command *t)
 }
 pp-p_next = proclist.p_next;
 proclist.p_next = pp;
-(void)gettimeofday(pp-p_btime, NULL);
+(void)clock_gettime(CLOCK_MONOTONIC, pp-p_btime);
 }
 
 static void
@@ -800,9 +800,9 @@ static void
 ptprint(struct process *tp)
 {
 static struct rusage zru;
-static struct timeval ztime;
+static struct timespec ztime;
 struct rusage ru;
-struct timeval tetime, diff;
+struct timespec tetime, diff;
 struct process *pp;
 
 pp = tp;
@@ -810,8 +810,8 @@ ptprint(struct process *tp)
 tetime = ztime;
 do {
 	ruadd(ru, pp-p_rusage);
-	timersub(pp-p_etime, pp-p_btime, diff);
-	if (timercmp(diff, 

CVS commit: src/bin/csh

2011-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  9 19:16:01 UTC 2011

Modified Files:
src/bin/csh: csh.h dol.c extern.h proc.c proc.h time.c

Log Message:
sync with /usr/bin/time, use CLOCK_MONOTONIC


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/csh.h
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/dol.c
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/extern.h
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/proc.c
cvs rdiff -u -r1.12 -r1.13 src/bin/csh/proc.h
cvs rdiff -u -r1.18 -r1.19 src/bin/csh/time.c

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



CVS commit: src/bin/csh

2011-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 24 14:44:11 UTC 2011

Modified Files:
src/bin/csh: file.c

Log Message:
csh has no business using TTYHOG


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/file.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/csh/file.c
diff -u src/bin/csh/file.c:1.28 src/bin/csh/file.c:1.29
--- src/bin/csh/file.c:1.28	Sat Feb 14 02:12:29 2009
+++ src/bin/csh/file.c	Sat Sep 24 10:44:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: file.c,v 1.28 2009/02/14 07:12:29 lukem Exp $ */
+/* $NetBSD: file.c,v 1.29 2011/09/24 14:44:11 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)file.c	8.2 (Berkeley) 3/19/94;
 #else
-__RCSID($NetBSD: file.c,v 1.28 2009/02/14 07:12:29 lukem Exp $);
+__RCSID($NetBSD: file.c,v 1.29 2011/09/24 14:44:11 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -161,10 +161,10 @@
 pushback(Char *string)
 {
 struct termios tty, tty_normal;
-char buf[TTYHOG], svchars[TTYHOG];
+char buf[64], svchars[sizeof(buf)];
 sigset_t nsigset, osigset;
 Char *p;
-int bufidx, i, len_str, nbuf, nsv, onsv, retrycnt;
+size_t bufidx, i, len_str, nbuf, nsv, onsv, retrycnt;
 char c;
 
 nsv = 0;
@@ -195,7 +195,7 @@
 
 	if (ioctl(SHOUT, FIONREAD, (ioctl_t) nbuf) ||
 	nbuf = len_str + nsv ||	/* The string fit. */
-	nbuf  TTYHOG)		/* For future binary compatibility
+	nbuf  sizeof(buf))		/* For future binary compatibility
 	   (and safety). */
 	break;
 
@@ -205,7 +205,7 @@
 	 */
 
 	/* This read() should be in noncanonical mode. */
-	if (read(SHOUT, buf, nbuf) != nbuf)
+	if (read(SHOUT, buf, nbuf) != (ssize_t)nbuf)
 	continue;		/* hangup? */
 
 	onsv = nsv;



CVS commit: src/bin/csh

2011-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 24 14:44:11 UTC 2011

Modified Files:
src/bin/csh: file.c

Log Message:
csh has no business using TTYHOG


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/bin/csh/file.c

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



CVS commit: src/bin/csh

2011-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 28 07:49:16 UTC 2011

Modified Files:
src/bin/csh: Makefile time.c
Removed Files:
src/bin/csh: strpct.c

Log Message:
use strpct(3) from libutil.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/Makefile
cvs rdiff -u -r1.8 -r0 src/bin/csh/strpct.c
cvs rdiff -u -r1.17 -r1.18 src/bin/csh/time.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/csh/Makefile
diff -u src/bin/csh/Makefile:1.32 src/bin/csh/Makefile:1.33
--- src/bin/csh/Makefile:1.32	Thu Aug 25 11:44:51 2011
+++ src/bin/csh/Makefile	Sun Aug 28 03:49:16 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.32 2011/08/25 15:44:51 joerg Exp $
+#	$NetBSD: Makefile,v 1.33 2011/08/28 07:49:16 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -13,7 +13,7 @@
 CPPFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
-	sem.c set.c str.c strpct.c time.c
+	sem.c set.c str.c time.c
 .PATH:	${NETBSDSRCDIR}/usr.bin/printf
 
 MLINKS=	csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \
@@ -55,7 +55,9 @@
 COPTS.err.c = -Wno-format-nonliteral
 COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
-COPTS.strpct.c = -Wno-format-nonliteral
+
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
 
 .include bsd.prog.mk
 .include bsd.subdir.mk

Index: src/bin/csh/time.c
diff -u src/bin/csh/time.c:1.17 src/bin/csh/time.c:1.18
--- src/bin/csh/time.c:1.17	Sun Feb 24 00:20:17 2008
+++ src/bin/csh/time.c	Sun Aug 28 03:49:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: time.c,v 1.17 2008/02/24 05:20:17 dholland Exp $ */
+/* $NetBSD: time.c,v 1.18 2011/08/28 07:49:16 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)time.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: time.c,v 1.17 2008/02/24 05:20:17 dholland Exp $);
+__RCSID($NetBSD: time.c,v 1.18 2011/08/28 07:49:16 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -44,13 +44,13 @@
 #include csh.h
 #include extern.h
 #endif
+#include util.h
 
 /*
  * C Shell - routines handling process timing and niceing
  */
 static void pdeltat(FILE *, struct timeval *, struct timeval *);
 static void pcsecs(FILE *, long);
-extern char *strpct(u_long, u_long, u_int);
 
 #ifndef NOT_CSH
 void
@@ -186,7 +186,9 @@
 		if (ms == 0) {
 			(void)fputs(0.0%, fp);
 		} else {
-			(void)fputs(strpct((ulong)t, (ulong)ms, 1), fp);
+			char pb[32];
+			(void)fputs(strpct(pb, sizeof(pb), t, ms, 1), fp);
+			(void)fputc('%', fp);
 		}
 		break;
 	case 'R':		/* page reclaims */



CVS commit: src/bin/csh

2011-08-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 28 07:49:16 UTC 2011

Modified Files:
src/bin/csh: Makefile time.c
Removed Files:
src/bin/csh: strpct.c

Log Message:
use strpct(3) from libutil.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/csh/Makefile
cvs rdiff -u -r1.8 -r0 src/bin/csh/strpct.c
cvs rdiff -u -r1.17 -r1.18 src/bin/csh/time.c

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



CVS commit: src/bin/csh

2011-08-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Aug 25 15:44:51 UTC 2011

Modified Files:
src/bin/csh: Makefile

Log Message:
Uses non-literal format strings in err.c


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/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/csh/Makefile
diff -u src/bin/csh/Makefile:1.31 src/bin/csh/Makefile:1.32
--- src/bin/csh/Makefile:1.31	Sun Aug 14 10:53:16 2011
+++ src/bin/csh/Makefile	Thu Aug 25 15:44:51 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.31 2011/08/14 10:53:16 christos Exp $
+#	$NetBSD: Makefile,v 1.32 2011/08/25 15:44:51 joerg Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -52,6 +52,7 @@
 .if defined(HAVE_GCC)  ${HAVE_GCC} == 4  ${MACHINE_ARCH} == vax
 COPTS.parse.c+=	-O0
 .endif
+COPTS.err.c = -Wno-format-nonliteral
 COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 COPTS.strpct.c = -Wno-format-nonliteral



CVS commit: src/bin/csh

2011-08-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Aug 25 15:44:51 UTC 2011

Modified Files:
src/bin/csh: Makefile

Log Message:
Uses non-literal format strings in err.c


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

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



  1   2   >