commit f1a0d8b0257f582bbff7e326c395455af4742f0f
parent 30aa5ecceb75531e6b68960b5d14a7d332dced2e
Author: sin <sin@2f30.org>
Date: Sun, 15 May 2016 13:25:33 +0100
Battery read plugin only works on OpenBSD so guard it
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/spoon.c b/spoon.c
@@ -1,15 +1,11 @@
#include <sys/types.h>
-#include <sys/ioctl.h>
#include <err.h>
-#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <machine/apmvar.h>
-
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
@@ -48,6 +44,11 @@ mpdread(char *buf, size_t len)
return 0;
}
+#ifdef __OpenBSD__
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <machine/apmvar.h>
+
int
battread(char *buf, size_t len)
{
@@ -71,6 +72,13 @@ battread(char *buf, size_t len)
snprintf(buf, len, "%d", info.battery_life);
return 0;
}
+#else
+int
+battread(char *buf, size_t len)
+{
+ return dummyread(buf, len);
+}
+#endif
int
dateread(char *buf, size_t len)