Xinqi Bao's Git
projects
/
slstatus.git
/ diff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
25bda72
)
Build Linux-only functions only on Linux
author
Aaron Marcher <
[email protected]
>
Sun, 18 Mar 2018 22:26:13 +0000
(23:26 +0100)
committer
Aaron Marcher <
[email protected]
>
Sun, 18 Mar 2018 22:26:13 +0000
(23:26 +0100)
components/battery.c
diff
|
blob
|
history
components/cpu.c
diff
|
blob
|
history
components/entropy.c
diff
|
blob
|
history
components/ip.c
diff
|
blob
|
history
components/ram.c
diff
|
blob
|
history
components/swap.c
diff
|
blob
|
history
components/temperature.c
diff
|
blob
|
history
components/uptime.c
diff
|
blob
|
history
components/volume.c
diff
|
blob
|
history
components/wifi.c
diff
|
blob
|
history
diff --git
a/components/battery.c
b/components/battery.c
index
f384aab
..
52ad343
100644
(file)
--- a/
components/battery.c
+++ b/
components/battery.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <limits.h>
#include <stdio.h>
#include <string.h>
#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;
}
}
return (i == LEN(map)) ? "?" : map[i].symbol;
}
+#endif
diff --git
a/components/cpu.c
b/components/cpu.c
index
4a4a80b
..
ef27ec5
100644
(file)
--- a/
components/cpu.c
+++ b/
components/cpu.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
@@
-61,3
+62,4
@@
cpu_iowait(void)
return bprintf("%d", perc);
}
return bprintf("%d", perc);
}
+#endif
diff --git
a/components/entropy.c
b/components/entropy.c
index
0d3564e
..
f1441b3
100644
(file)
--- a/
components/entropy.c
+++ b/
components/entropy.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <stdio.h>
#include "../util.h"
#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;
}
return (pscanf("/proc/sys/kernel/random/entropy_avail", "%d", &num) == 1) ?
bprintf("%d", num) : NULL;
}
+#endif
diff --git
a/components/ip.c
b/components/ip.c
index
f98b2ed
..
8a40cfe
100644
(file)
--- a/
components/ip.c
+++ b/
components/ip.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <err.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <err.h>
#include <ifaddrs.h>
#include <netdb.h>
@@
-68,3
+69,4
@@
ipv6(const char *iface)
return NULL;
}
return NULL;
}
+#endif
diff --git
a/components/ram.c
b/components/ram.c
index
f696039
..
334a203
100644
(file)
--- a/
components/ram.c
+++ b/
components/ram.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <stdio.h>
#include "../util.h"
#include <stdio.h>
#include "../util.h"
@@
-50,3
+51,4
@@
ram_used(void)
bprintf("%f", (float)(total - free - buffers - cached) / 1024 / 1024) :
NULL;
}
bprintf("%f", (float)(total - free - buffers - cached) / 1024 / 1024) :
NULL;
}
+#endif
diff --git
a/components/swap.c
b/components/swap.c
index
e4eec64
..
a030f5f
100644
(file)
--- a/
components/swap.c
+++ b/
components/swap.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <err.h>
#include <stdio.h>
#include <string.h>
#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);
}
return bprintf("%f", (float)(total - free - cached) / 1024 / 1024);
}
+#endif
diff --git
a/components/temperature.c
b/components/temperature.c
index
bbd4daf
..
6376e30
100644
(file)
--- a/
components/temperature.c
+++ b/
components/temperature.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <stdio.h>
#include "../util.h"
#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;
}
return (pscanf(file, "%d", &temp) == 1) ?
bprintf("%d", temp / 1000) : NULL;
}
+#endif
diff --git
a/components/uptime.c
b/components/uptime.c
index
b455182
..
36f03b1
100644
(file)
--- a/
components/uptime.c
+++ b/
components/uptime.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <sys/sysinfo.h>
#include "../util.h"
#include <sys/sysinfo.h>
#include "../util.h"
@@
-16,3
+17,4
@@
uptime(void)
return bprintf("%dh %dm", h, m);
}
return bprintf("%dh %dm", h, m);
}
+#endif
diff --git
a/components/volume.c
b/components/volume.c
index
f5aa18d
..
a4b49bb
100644
(file)
--- a/
components/volume.c
+++ b/
components/volume.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <err.h>
#include <fcntl.h>
#include <sys/soundcard.h>
#include <err.h>
#include <fcntl.h>
#include <sys/soundcard.h>
@@
-41,3
+42,4
@@
vol_perc(const char *card)
return bprintf("%d", v & 0xff);
}
return bprintf("%d", v & 0xff);
}
+#endif
diff --git
a/components/wifi.c
b/components/wifi.c
index
3767b21
..
084ab99
100644
(file)
--- a/
components/wifi.c
+++ b/
components/wifi.c
@@
-1,4
+1,5
@@
/* See LICENSE file for copyright and license details. */
/* See LICENSE file for copyright and license details. */
+#ifdef __linux__
#include <err.h>
#include <ifaddrs.h>
#include <linux/wireless.h>
#include <err.h>
#include <ifaddrs.h>
#include <linux/wireless.h>
@@
-88,3
+89,4
@@
wifi_essid(const char *iface)
else
return id;
}
else
return id;
}
+#endif