Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/top add a command ('S') to toggle display of system ...



details:   https://anonhg.NetBSD.org/src/rev/71227f97b094
branches:  trunk
changeset: 511515:71227f97b094
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jun 20 19:56:35 2001 +0000

description:
add a command ('S') to toggle display of system processes.
It is annoying to have to quit and use top -S to toggle.

diffstat:

 usr.bin/top/commands.c |   3 ++-
 usr.bin/top/top.c      |  22 +++++++++++++++-------
 2 files changed, 17 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r 9bdbb8d32e0d -r 71227f97b094 usr.bin/top/commands.c
--- a/usr.bin/top/commands.c    Wed Jun 20 19:52:19 2001 +0000
+++ b/usr.bin/top/commands.c    Wed Jun 20 19:56:35 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: commands.c,v 1.5 2000/01/21 17:08:37 mycroft Exp $     */
+/*     $NetBSD: commands.c,v 1.6 2001/06/20 19:56:35 christos Exp $    */
 
 /*
  *  Top users/processes display for Unix
@@ -87,6 +87,7 @@
        fputs("\
 r       - renice a process\n\
 s       - change number of seconds to delay between updates\n\
+S       - toggle showing system processes\n\
 u       - display processes for only one user (+ selects all users)\n\
 \n\
 \n", stdout);
diff -r 9bdbb8d32e0d -r 71227f97b094 usr.bin/top/top.c
--- a/usr.bin/top/top.c Wed Jun 20 19:52:19 2001 +0000
+++ b/usr.bin/top/top.c Wed Jun 20 19:56:35 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: top.c,v 1.8 2001/05/22 15:38:22 christos Exp $ */
+/*     $NetBSD: top.c,v 1.9 2001/06/20 19:56:35 christos Exp $ */
 
 char *copyright =
     "Copyright (c) 1984 through 1996, William LeFebvre";
@@ -139,9 +139,9 @@
     fd_set readfds;
 
 #ifdef ORDER
-    static char command_chars[] = "\f qh?en#sdkriIuo";
+    static char command_chars[] = "\f qh?en#sdkrSiIuo";
 #else
-    static char command_chars[] = "\f qh?en#sdkriIu";
+    static char command_chars[] = "\f qh?en#sdkrSiIu";
 #endif
 /* these defines enumerate the "strchr"s of the commands in command_chars */
 #define CMD_redraw     0
@@ -157,11 +157,12 @@
 #define CMD_displays   9
 #define CMD_kill       10
 #define CMD_renice     11
-#define CMD_idletog     12
-#define CMD_idletog2    13
-#define CMD_user       14
+#define CMD_system     12
+#define CMD_idletog     13
+#define CMD_idletog2    14
+#define CMD_user       15
 #ifdef ORDER
-#define CMD_order       15
+#define CMD_order       16
 #endif
 
     /* set the buffer for stdout */
@@ -799,6 +800,13 @@
                                }
                                break;
 
+                           case CMD_system:
+                               ps.system = !ps.system;
+                               new_message(MT_standout | MT_delayed,
+                                   " %sisplaying system processes.",
+                                   ps.system ? "D" : "Not d");
+                               break;
+
                            case CMD_idletog:
                            case CMD_idletog2:
                                ps.idle = !ps.idle;



Home | Main Index | Thread Index | Old Index