]> granicus.if.org Git - sysstat/commitdiff
A_PWR_BAT: Use colors to display negative values
authorSebastien GODARD <sysstat@users.noreply.github.com>
Thu, 29 Dec 2022 07:37:18 +0000 (08:37 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Thu, 29 Dec 2022 07:37:18 +0000 (08:37 +0100)
Two thresholds are defined: -10.0 and -5.0.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
common.c

index 256451c2dff71ef3c17a0b1d01f14e6a4b37c8b3..ed144d950dcce00282d0905a385911213c018658 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1411,6 +1411,12 @@ void cprintf_f(int unit, int sign, int num, int wi, int wd, ...)
                    ((wd == 0) && (val <= 0.5) && (val >= -0.5))) {     /* "Round half to even" law */
                        printf("%s", sc_zero_int_stat);
                }
+               else if (sign && (val <= -10.0)) {
+                       printf("%s", sc_percent_xtreme);
+               }
+               else if (sign && (val <= -5.0)) {
+                       printf("%s", sc_percent_warn);
+               }
                else {
                        printf("%s", sc_int_stat);
                }