summaryrefslogtreecommitdiff
path: root/dwmstatus-temperature.c
blob: 13f27f6325c37fe238bff09d04b80597e904aa67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
}