summaryrefslogtreecommitdiff
path: root/src/print_cpu_temperature.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-10-16 10:52:57 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-10-16 10:52:57 +0200
commit450424f97a9d02e5392ce331902c95d0fa0e82ec (patch)
treec30c13a56209a579af3747cb9e9830f51e0db2fb /src/print_cpu_temperature.c
parentae4873bac793245e7dea4719c8e0d1c7bc990d5f (diff)
implement max_threshold for linux, too
Diffstat (limited to 'src/print_cpu_temperature.c')
-rw-r--r--src/print_cpu_temperature.c9
1 files changed, 8 insertions, 1 deletions
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);