aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-01-28 14:22:46 -0600
committerRob Landley <rob@landley.net>2016-01-28 14:22:46 -0600
commit852740618edc876ac7416e18c2f92f78707cd708 (patch)
treec24dc3ae0c5e61a17e2f39dcde890ba6b065d996
parent8f7137e4e4850e17eea8c045865885bb1bc2f3bc (diff)
downloadtoybox-852740618edc876ac7416e18c2f92f78707cd708.tar.gz
Adding -M broke ps -k header printing without -M.
-rw-r--r--toys/posix/ps.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 42dd193d..c95f73f5 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1057,10 +1057,8 @@ void ps_main(void)
// Calculate seen fields bit array, and if we aren't deferring printing
// print headers now (for low memory/nommu systems).
TT.bits = get_headers(TT.fields, toybuf, sizeof(toybuf));
- if (!(toys.optflags&(FLAG_k|FLAG_M))) {
- TT.show_process = (void *)show_ps;
- printf("%s\n", toybuf);
- }
+ if (!(toys.optflags&FLAG_M)) printf("%s\n", toybuf);
+ if (!(toys.optflags&(FLAG_k|FLAG_M))) TT.show_process = (void *)show_ps;
TT.match_process = ps_match_process;
dt = dirtree_read("/proc", get_ps);
@@ -1080,8 +1078,8 @@ void ps_main(void)
// Now that we've recalculated field widths, re-pad headers again
get_headers(TT.fields, toybuf, sizeof(toybuf));
+ printf("%s\n", toybuf);
}
- printf("%s\n", toybuf);
if (toys.optflags&FLAG_k)
qsort(tbsort, TT.kcount, sizeof(struct carveup *), (void *)ksort);