Build Linux-only functions only on Linux
authorAaron Marcher <me@drkhsh.at>
Sun, 18 Mar 2018 22:26:13 +0000 (23:26 +0100)
committerAaron Marcher <me@drkhsh.at>
Sun, 18 Mar 2018 22:26:13 +0000 (23:26 +0100)
components/battery.c
components/cpu.c
components/entropy.c
components/ip.c
components/ram.c
components/swap.c
components/temperature.c
components/uptime.c
components/volume.c
components/wifi.c

index f384aab11b864b345b64120f4547eb6c6d787d32..52ad34370e104d82473047bf8b19878d930e8447 100644 (file)
@@ -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 @@ battery_state(const char *bat)
        }
        return (i == LEN(map)) ? "?" : map[i].symbol;
 }
+#endif
index 4a4a80bb98a83b7f64bfa4d8536deae422a9e6ac..ef27ec5a3d4702c7f6581b3b18e295f691cb1d9b 100644 (file)
@@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#ifdef __linux__
 #include <stdio.h>
 #include <string.h>
 
@@ -61,3 +62,4 @@ cpu_iowait(void)
 
        return bprintf("%d", perc);
 }
+#endif
index 0d3564ea1de68d7a5f346b36051fa36d4307a5bb..f1441b370001d4e849ddde173a7d7671a31e1cc9 100644 (file)
@@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#ifdef __linux__
 #include <stdio.h>
 
 #include "../util.h"
@@ -11,3 +12,4 @@ entropy(void)
        return (pscanf("/proc/sys/kernel/random/entropy_avail", "%d", &num) == 1) ?
                       bprintf("%d", num) : NULL;
 }
+#endif
index f98b2edb50fb23b75bd50906fd7765b2836be208..8a40cfe577eb8343554fb87ad1944ff86319680d 100644 (file)
@@ -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 @@ ipv6(const char *iface)
 
        return NULL;
 }
+#endif
index f696039d3206be430248f140d6e8d666bdcf0d97..334a203347befd45d58bf705dc6749bf4176c589 100644 (file)
@@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#ifdef __linux__
 #include <stdio.h>
 
 #include "../util.h"
@@ -50,3 +51,4 @@ ram_used(void)
               bprintf("%f", (float)(total - free - buffers - cached) / 1024 / 1024) :
               NULL;
 }
+#endif
index e4eec64c3fdf76ba2d7580126ce69a5e845546a2..a030f5f35657e0b93c8622a28bbf68fd56432a93 100644 (file)
@@ -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 @@ swap_used(void)
 
        return bprintf("%f", (float)(total - free - cached) / 1024 / 1024);
 }
+#endif
index bbd4daf0ed9f54304e0b9573c605d03084b06322..6376e30f79942964355accc6a2f7cd6bfcc5560d 100644 (file)
@@ -1,4 +1,5 @@
 /* See LICENSE file for copyright and license details. */
+#ifdef __linux__
 #include <stdio.h>
 
 #include "../util.h"
@@ -11,3 +12,4 @@ temp(const char *file)
        return (pscanf(file, "%d", &temp) == 1) ?
               bprintf("%d", temp / 1000) : NULL;
 }
+#endif
index b45518289be3b56358eeadfd58fc983d96f03679..36f03b1f39d366784de643ab1caa9df41aebc144 100644 (file)
@@ -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 @@ uptime(void)
 
        return bprintf("%dh %dm", h, m);
 }
+#endif
index f5aa18d332a41283d75e45ec9b6d1317c4b290f5..a4b49bb2c9a282497726b6a0e6865ca12b197aa9 100644 (file)
@@ -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 @@ vol_perc(const char *card)
 
        return bprintf("%d", v & 0xff);
 }
+#endif
index 3767b21759211ed48cfa1fb057d67b2d45228bd6..084ab99178baeb5686fccb329c52a6deb54b901f 100644 (file)
@@ -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 @@ wifi_essid(const char *iface)
        else
                return id;
 }
+#endif