Compare commits

..

1 Commits

Author SHA1 Message Date
4aedc1e9cc Fix return type of gettemperature
I get this error when trying to build my NixOS system with the nixos-25.05 channel:

dwmstatus.c: In function 'gettemperature':
dwmstatus.c:182:24: error: returning 'char *' from a function with return type 'int' makes integer from pointer without a cast []
  182 |                 return smprintf("");
      |                        ^~~~~~~~~~~~
2025-06-08 14:40:37 +02:00

View File

@ -20,7 +20,6 @@
char *tzargentina = "America/Buenos_Aires";
char *tzutc = "UTC";
char *tzberlin = "Europe/Berlin";
char *tzaustin = "America/Mexico_City";
static Display *dpy;
@ -180,9 +179,8 @@ gettemperature(char *base, char *sensor)
co = readfile(base, sensor);
if (co == NULL)
return smprintf("");
return atof(co) / 1000;
// return smprintf("%02.0f°C", atof(co) / 1000);
return 0;
return atof(co) / 1000;
}
char *
@ -231,7 +229,7 @@ main(void)
bat = getbattery("/sys/class/power_supply/BAT0");
// tmar = mktimes("%H:%M", tzargentina);
// tmutc = mktimes("%H:%M", tzutc);
tmbln = mktimes("%a %d %b %H:%M %Z %Y", tzaustin);
tmbln = mktimes("%a %d %b %H:%M %Z %Y", tzberlin);
// kbmap = execscript("setxkbmap -query | grep layout | cut -d':' -f 2- | tr -d ' '");
// surfs = execscript("surf-status");
t0 = gettemperature("/sys/devices/virtual/thermal/thermal_zone0", "temp");