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 $");
 #endif
 #endif /* not lint */
 
@@ -842,9 +842,16 @@ dojobs(Char **v, struct command *t)
     if (chkstop)
 	chkstop = 2;
     if (*++v) {
-	if (v[1] || !eq(*v, STRml))
-	    stderror(ERR_JOBS);
-	flag |= FANCY | JOBDIR;
+	if (v[1]) {
+	    if (eq(*v, STRml)) {
+		flag |= FANCY | JOBDIR;
+	    } else if (eq(*v, STRmZ) && v[1]) {
+		setproctitle("%s", short2str(v[1]));
+		return;
+	    } else {
+		stderror(ERR_JOBS);
+	    }
+	}
     }
     for (i = 1; i <= pmaxindex; i++)
 	for (pp = proclist.p_next; pp; pp = pp->p_next)

Reply via email to