From a1751622782eb9d3d9bfae56b75b857d8cbd0c6c Mon Sep 17 00:00:00 2001 From: Christoph Lohmann <20h@r-36.net> Date: Sun, 10 Sep 2017 19:28:54 +0200 Subject: Initial commit. --- dwmstatus-temperature.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 dwmstatus-temperature.c (limited to 'dwmstatus-temperature.c') diff --git a/dwmstatus-temperature.c b/dwmstatus-temperature.c new file mode 100644 index 0000000..13f27f6 --- /dev/null +++ b/dwmstatus-temperature.c @@ -0,0 +1,15 @@ +/* + * gettemperature("/sys/class/hwmon/hwmon0/device", "temp1_input"); + */ + +char * +gettemperature(char *base, char *sensor) +{ + char *co; + + co = readfile(base, sensor); + if (co == NULL) + return smprintf(""); + return smprintf("%02.0f°C", atof(co) / 1000); +} + -- cgit v1.2.3