Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/csh like zsh, have jobs -Z do setproctitle



details:   https://anonhg.NetBSD.org/src/rev/f549f1eb3750
branches:  trunk
changeset: 985875:f549f1eb3750
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Sep 11 20:55:03 2021 +0000

description:
like zsh, have jobs -Z do setproctitle

diffstat:

 bin/csh/const.c |   5 +++--
 bin/csh/csh.1   |  10 +++++++---
 bin/csh/err.c   |   6 +++---
 bin/csh/init.c  |   6 +++---
 bin/csh/proc.c  |  17 ++++++++++++-----
 5 files changed, 28 insertions(+), 16 deletions(-)

diffs (152 lines):

diff -r 2f9c545f4e67 -r f549f1eb3750 bin/csh/const.c
--- a/bin/csh/const.c   Sat Sep 11 20:43:32 2021 +0000
+++ b/bin/csh/const.c   Sat Sep 11 20:55:03 2021 +0000
@@ -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 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' };
diff -r 2f9c545f4e67 -r f549f1eb3750 bin/csh/csh.1
--- a/bin/csh/csh.1     Sat Sep 11 20:43:32 2021 +0000
+++ b/bin/csh/csh.1     Sat Sep 11 20:55:03 2021 +0000
@@ -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 @@
 .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 ...
diff -r 2f9c545f4e67 -r f549f1eb3750 bin/csh/err.c
--- a/bin/csh/err.c     Sat Sep 11 20:43:32 2021 +0000
+++ b/bin/csh/err.c     Sat Sep 11 20:55:03 2021 +0000
@@ -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 @@
 #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
diff -r 2f9c545f4e67 -r f549f1eb3750 bin/csh/init.c
--- a/bin/csh/init.c    Sat Sep 11 20:43:32 2021 +0000
+++ b/bin/csh/init.c    Sat Sep 11 20:55:03 2021 +0000
@@ -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 @@
     { "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  },
diff -r 2f9c545f4e67 -r f549f1eb3750 bin/csh/proc.c
--- a/bin/csh/proc.c    Sat Sep 11 20:43:32 2021 +0000
+++ b/bin/csh/proc.c    Sat Sep 11 20:55:03 2021 +0000
@@ -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 @@
     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)



Home | Main Index | Thread Index | Old Index