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/top.c | |
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/top.c')
-rw-r--r-- | contrib/top/top.c | 24 |
1 files changed, 19 insertions, 5 deletions
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: "); |