From 852740618edc876ac7416e18c2f92f78707cd708 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 28 Jan 2016 14:22:46 -0600 Subject: Adding -M broke ps -k header printing without -M. --- toys/posix/ps.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'toys') 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); -- cgit v1.2.3