---
 toys/posix/ps.c | 5 +++++
 1 file changed, 5 insertions(+)
From 2018ddfc88b334aff5b768a053c2617d2a23a27c Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Mon, 11 Jun 2018 17:14:29 -0700
Subject: [PATCH] top: running processes are shown in bold.

---
 toys/posix/ps.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index deab730..75e8f54 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1550,8 +1550,13 @@ static void top_common(
       recalc = 1;
 
       for (i = 0; i<lines && i+topoff<mix.count; i++) {
+        // Running processes are shown in bold.
+        int bold = !(toys.optflags&FLAG_b) && mix.tb[i+topoff]->state == 'R';
+
         if (!(toys.optflags&FLAG_b) && i) xputc('\n');
+        if (bold) printf("\033[1m");
         show_ps(mix.tb[i+topoff]);
+        if (bold) printf("\033[m");
       }
 
       if (TT.top.n && !--TT.top.n) {
-- 
2.18.0.rc1.242.g61856ae69a-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to