Source-Changes-HG archive

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

[src/netbsd-3]: src/usr.bin/systat Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/5c688735f888
branches:  netbsd-3
changeset: 577840:5c688735f888
user:      riz <riz%NetBSD.org@localhost>
date:      Wed Feb 15 19:45:13 2006 +0000

description:
Pull up following revision(s) (requested by kleink in ticket #1172):
        usr.bin/systat/ps.c: revision 1.28
Print system processes' command names in square brackets, like ps(1) does.

diffstat:

 usr.bin/systat/ps.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 616f0824defa -r 5c688735f888 usr.bin/systat/ps.c
--- a/usr.bin/systat/ps.c       Wed Feb 15 19:38:52 2006 +0000
+++ b/usr.bin/systat/ps.c       Wed Feb 15 19:45:13 2006 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ps.c,v 1.26 2005/02/26 22:12:33 dsl Exp $  */
+/*      $NetBSD: ps.c,v 1.26.2.1 2006/02/15 19:45:13 riz Exp $  */
 
 /*-
  * Copyright (c) 1999
@@ -45,7 +45,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ps.c,v 1.26 2005/02/26 22:12:33 dsl Exp $");
+__RCSID("$NetBSD: ps.c,v 1.26.2.1 2006/02/15 19:45:13 riz Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -278,8 +278,21 @@
                        argv++;
                        strlcat(commstr, " ", sizeof(commstr));
                }
-       } else
-               snprintf(commstr, sizeof(commstr), "(%s)", kp->p_comm);
+       } else {
+               const char *fmt;
+
+               /*
+                * Commands that don't set an argv vector are printed with
+                * square brackets if they are system commands.  Otherwise
+                * they are printed within parentheses.
+                */
+               if (kp->p_flag & P_SYSTEM)
+                       fmt = "[%s]";
+               else
+                       fmt = "(%s)";
+
+               snprintf(commstr, sizeof(commstr), fmt, kp->p_comm);
+       }
 
        return commstr;
 }



Home | Main Index | Thread Index | Old Index