From 450424f97a9d02e5392ce331902c95d0fa0e82ec Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 16 Oct 2012 10:52:57 +0200 Subject: [PATCH] implement max_threshold for linux, too --- src/print_cpu_temperature.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index 034a079..e3340f6 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -63,8 +63,15 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const temp = strtol(buf, NULL, 10); if (temp == LONG_MIN || temp == LONG_MAX || temp <= 0) *(outwalk++) = '?'; - else + else { + if ((temp/1000) >= max_threshold) { + START_COLOR("color_bad"); + colorful_output = true; + } outwalk += sprintf(outwalk, "%ld", (temp/1000)); + if (colorful_output) + END_COLOR; + } #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int sysctl_rslt; size_t sysctl_size = sizeof(sysctl_rslt); -- 2.39.5