diff options
author | Miles Bader <miles@gnu.org> | 1996-12-17 02:00:41 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-12-17 02:00:41 +0000 |
commit | 064bccb00ac5330cd2510be8a03ff40086be5bf8 (patch) | |
tree | 5457ff361d35eb7ec8d4f76005a28a03b4b0c614 /utils | |
parent | 57c9e8c2367ba89c6bee529e7764f63b5235e4ea (diff) |
(psout):
Use last N processes if TOP is negative.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/psout.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/utils/psout.c b/utils/psout.c index df991f88..3c39eff0 100644 --- a/utils/psout.c +++ b/utils/psout.c @@ -119,13 +119,20 @@ psout (struct proc_stat_list *procs, } if (top) - /* Restrict output to the top TOP entries. */ + /* Restrict output to the top TOP entries, if TOP is positive, or the + bottom -TOP entries, if it is negative. */ { int filter (struct proc_stat *ps) { return --top >= 0; } - proc_stat_list_filter1 (procs, filter, 0, 0); + if (top < 0) + { + top += procs->num_procs; + proc_stat_list_filter1 (procs, filter, 0, 1); + } + else + proc_stat_list_filter1 (procs, filter, 0, 0); } /* Finally, output all the processes! */ |