diff options
author | des <des@FreeBSD.org> | 1998-08-04 14:10:48 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 1998-08-04 14:10:48 +0000 |
commit | e8ccb4f081316fdb1146a5b00fc424fd5b6a7649 (patch) | |
tree | 7f243251c25e7624a0b4b77106b75aeda0252746 /contrib/top | |
parent | e0fcaa07d2408a1d03d13f511c35e030b08813cc (diff) | |
download | FreeBSD-src-e8ccb4f081316fdb1146a5b00fc424fd5b6a7649.zip FreeBSD-src-e8ccb4f081316fdb1146a5b00fc424fd5b6a7649.tar.gz |
Add -t option ('t' in interactive mode) to make top(1) ignore itself.
Attempts to contact the author of top(1) (William LeFebvre) have so
far been unsuccessful.
PR: 7253
Submitted by: Yours Truly
Diffstat (limited to 'contrib/top')
-rw-r--r-- | contrib/top/machine.h | 1 | ||||
-rw-r--r-- | contrib/top/top.X | 14 | ||||
-rw-r--r-- | contrib/top/top.c | 24 |
3 files changed, 32 insertions, 7 deletions
diff --git a/contrib/top/machine.h b/contrib/top/machine.h index 243ba27..0a9953f 100644 --- a/contrib/top/machine.h +++ b/contrib/top/machine.h @@ -46,6 +46,7 @@ struct system_info struct process_select { int idle; /* show idle processes */ + int self; /* show self */ int system; /* show system processes */ int uid; /* only this uid (unless uid == -1) */ char *command; /* only this command (unless == NULL) */ diff --git a/contrib/top/top.X b/contrib/top/top.X index aa50026..b6bece8 100644 --- a/contrib/top/top.X +++ b/contrib/top/top.X @@ -9,7 +9,7 @@ top \- display and update information about the top cpu processes .SH SYNOPSIS .B top [ -.B \-SbiInqu +.B \-SbiInqut ] [ .BI \-d count ] [ @@ -81,6 +81,11 @@ intelligent terminal. Do not display idle processes. By default, top displays both active and idle processes. .TP +.B \-t +Do not display the +.I top +process. +.TP .B \-n Use \*(lqnon-interactive\*(rq mode. This is identical to \*(lqbatch\*(rq mode. @@ -153,8 +158,9 @@ can also be specified in the environment variable The options .BR \-I , .BR \-S , +.BR \-u , and -.B \-u +.B \-t are actually toggles. A second specification of any of these options will negate the first. Thus a user who has the environment variable .B TOP @@ -234,6 +240,10 @@ command. (or .BR I) Toggle the display of idle processes. +.B t +Toggle the display of the +.I top +process. .SH "THE DISPLAY" The actual display varies depending on the specific variant of Unix that the machine is running. This description may not exactly match diff --git a/contrib/top/top.c b/contrib/top/top.c index 1902abb..ef4b963 100644 --- a/contrib/top/top.c +++ b/contrib/top/top.c @@ -185,9 +185,9 @@ char *argv[]; fd_set readfds; #ifdef ORDER - static char command_chars[] = "\f qh?en#sdkriIuo"; + static char command_chars[] = "\f qh?en#sdkriIuto"; #else - static char command_chars[] = "\f qh?en#sdkriIu"; + static char command_chars[] = "\f qh?en#sdkriIut"; #endif /* these defines enumerate the "strchr"s of the commands in command_chars */ #define CMD_redraw 0 @@ -206,8 +206,9 @@ char *argv[]; #define CMD_idletog 12 #define CMD_idletog2 13 #define CMD_user 14 +#define CMD_selftog 15 #ifdef ORDER -#define CMD_order 15 +#define CMD_order 16 #endif /* set the buffer for stdout */ @@ -232,6 +233,7 @@ char *argv[]; /* initialize some selection options */ ps.idle = Yes; + ps.self = -1; ps.system = No; ps.uid = -1; ps.command = NULL; @@ -259,7 +261,7 @@ char *argv[]; optind = 1; } - while ((i = getopt(ac, av, "SIbinqus:d:U:o:")) != EOF) + while ((i = getopt(ac, av, "SIbinqus:d:U:o:t")) != EOF) { switch(i) { @@ -344,10 +346,14 @@ char *argv[]; #endif break; + case 't': + ps.self = (ps.self == -1) ? getpid() : -1; + break; + default: fprintf(stderr, "\ Top version %s\n\ -Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n", +Usage: %s [-ISbinqut] [-d x] [-s x] [-o field] [-U username] [number]\n", version_string(), myname); exit(1); } @@ -837,6 +843,14 @@ Usage: %s [-ISbinqu] [-d x] [-s x] [-o field] [-U username] [number]\n", putchar('\r'); break; + case CMD_selftog: + ps.self = (ps.self == -1) ? getpid() : -1; + new_message(MT_standout | MT_delayed, + " %sisplaying self.", + (ps.self == -1) ? "D" : "Not d"); + putchar('\r'); + break; + case CMD_user: new_message(MT_standout, "Username to show: "); |