all repos — slstatus @ ebf5a35052add4298e43e0f261927b7ab2a2e7b9

my build of slstatus (tools.suckless.org/slstatus/)

Build Linux-only functions only on Linux
Aaron Marcher me@drkhsh.at
Sun, 18 Mar 2018 23:26:13 +0100
commit

ebf5a35052add4298e43e0f261927b7ab2a2e7b9

parent

25bda72e646a93446ebb686cfd5252ea2d5d06a2

M components/battery.ccomponents/battery.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <limits.h> #include <stdio.h> #include <string.h>

@@ -54,3 +55,4 @@ }

} return (i == LEN(map)) ? "?" : map[i].symbol; } +#endif
M components/cpu.ccomponents/cpu.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <stdio.h> #include <string.h>

@@ -61,3 +62,4 @@ ((b[0]+b[1]+b[2]+b[3]+b[4]+b[5]+b[6]) - (a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]));

return bprintf("%d", perc); } +#endif
M components/entropy.ccomponents/entropy.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <stdio.h> #include "../util.h"

@@ -11,3 +12,4 @@

return (pscanf("/proc/sys/kernel/random/entropy_avail", "%d", &num) == 1) ? bprintf("%d", num) : NULL; } +#endif
M components/ip.ccomponents/ip.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <err.h> #include <ifaddrs.h> #include <netdb.h>

@@ -68,3 +69,4 @@ freeifaddrs(ifaddr);

return NULL; } +#endif
M components/ram.ccomponents/ram.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <stdio.h> #include "../util.h"

@@ -50,3 +51,4 @@ &total, &free, &buffers, &buffers, &cached) == 5) ?

bprintf("%f", (float)(total - free - buffers - cached) / 1024 / 1024) : NULL; } +#endif
M components/swap.ccomponents/swap.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <err.h> #include <stdio.h> #include <string.h>

@@ -134,3 +135,4 @@ sscanf(match, "SwapFree: %ld kB\n", &free);

return bprintf("%f", (float)(total - free - cached) / 1024 / 1024); } +#endif
M components/temperature.ccomponents/temperature.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <stdio.h> #include "../util.h"

@@ -11,3 +12,4 @@

return (pscanf(file, "%d", &temp) == 1) ? bprintf("%d", temp / 1000) : NULL; } +#endif
M components/uptime.ccomponents/uptime.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <sys/sysinfo.h> #include "../util.h"

@@ -16,3 +17,4 @@ m = (info.uptime - h * 3600 ) / 60;

return bprintf("%dh %dm", h, m); } +#endif
M components/volume.ccomponents/volume.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <err.h> #include <fcntl.h> #include <sys/soundcard.h>

@@ -41,3 +42,4 @@ close(afd);

return bprintf("%d", v & 0xff); } +#endif
M components/wifi.ccomponents/wifi.c

@@ -1,4 +1,5 @@

/* See LICENSE file for copyright and license details. */ +#ifdef __linux__ #include <err.h> #include <ifaddrs.h> #include <linux/wireless.h>

@@ -88,3 +89,4 @@ return NULL;

else return id; } +#endif