diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-09-10 19:56:33 +0200 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-11-16 16:38:54 +0100 |
commit | 1b225cd7a0af03a6349c48326118a287fc36acd0 (patch) | |
tree | dff0955221e7fce63e2308febbefdd58213d16c3 /CRT.c | |
parent | 309f1d7282ec8efa4ff6b24a001a4908f5fd28d0 (diff) |
Show CPU temperature in CPU meter
Show the CPU temperature in the CPU meter, like CPU frequency, instead
of using an extra Meter.
Diffstat (limited to 'CRT.c')
-rw-r--r-- | CRT.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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() { |