From 1b225cd7a0af03a6349c48326118a287fc36acd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Thu, 10 Sep 2020 19:56:33 +0200 Subject: Show CPU temperature in CPU meter Show the CPU temperature in the CPU meter, like CPU frequency, instead of using an extra Meter. --- CRT.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'CRT.c') diff --git a/CRT.c b/CRT.c index 96bc1566..17a3e12c 100644 --- a/CRT.c +++ b/CRT.c @@ -74,6 +74,23 @@ const char* const* CRT_treeStr = CRT_treeStrAscii; int CRT_delay; +const char* CRT_degreeSign; + +static const char* initDegreeSign(void) { +#ifdef HAVE_LIBNCURSESW + if (CRT_utf8) + return "\xc2\xb0"; +#endif + + static char buffer[4]; + // this might fail if the current locale does not support wide characters + int r = snprintf(buffer, sizeof(buffer), "%lc", 176); + if (r > 0) + return buffer; + + return ""; +} + const int* CRT_colors; int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { @@ -718,6 +735,8 @@ void CRT_init(int delay, int colorScheme, bool allowUnicode) { if (CRT_pageSize == -1) CRT_fatalError("Fatal error: Can not get PAGE_SIZE by sysconf(_SC_PAGESIZE)"); CRT_pageSizeKB = CRT_pageSize / 1024; + + CRT_degreeSign = initDegreeSign(); } void CRT_done() { -- cgit v1.2.3