Module Name:    src
Committed By:   christos
Date:           Thu Sep 16 19:43:33 UTC 2021

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

Log Message:
support -Z


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

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

Modified files:

Index: src/bin/ksh/c_ksh.c
diff -u src/bin/ksh/c_ksh.c:1.29 src/bin/ksh/c_ksh.c:1.30
--- src/bin/ksh/c_ksh.c:1.29	Sun Jun  3 08:18:29 2018
+++ src/bin/ksh/c_ksh.c	Thu Sep 16 15:43:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: c_ksh.c,v 1.29 2018/06/03 12:18:29 kamil Exp $	*/
+/*	$NetBSD: c_ksh.c,v 1.30 2021/09/16 19:43:33 christos Exp $	*/
 
 /*
  * built-in Korn commands: c_*
@@ -6,7 +6,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: c_ksh.c,v 1.29 2018/06/03 12:18:29 kamil Exp $");
+__RCSID("$NetBSD: c_ksh.c,v 1.30 2021/09/16 19:43:33 christos Exp $");
 #endif
 
 #include <sys/stat.h>
@@ -1072,9 +1072,10 @@ c_jobs(wp)
 	int optc;
 	int flag = 0;
 	int nflag = 0;
+	int Zflag = 0;
 	int rv = 0;
 
-	while ((optc = ksh_getopt(wp, &builtin_opt, "lpnz")) != EOF)
+	while ((optc = ksh_getopt(wp, &builtin_opt, "lpnzZ")) != EOF)
 		switch (optc) {
 		  case 'l':
 			flag = 1;
@@ -1088,10 +1089,21 @@ c_jobs(wp)
 		  case 'z':	/* debugging: print zombies */
 			nflag = -1;
 			break;
+		  case 'Z':
+			Zflag = 1;
+			break;
 		  case '?':
 			return 1;
 		}
 	wp += builtin_opt.optind;
+	if (Zflag) {
+		if (*wp && **wp) {
+			setproctitle("%s", *wp);
+		} else {
+			setproctitle(NULL);
+		}
+		return 0;
+	}
 	if (!*wp) {
 		if (j_jobs((char *) 0, flag, nflag))
 			rv = 1;

Reply via email to