xbattmon

simple battery monitor for X
git clone git://git.2f30.org/xbattmon
Log | Files | Refs | README | LICENSE

commit fc019739005f332931990ac375234689392a5805
parent 1712a1693180f45d40046eb1c7fa162d998aab23
Author: Klemens Nanni <kl3@posteo.org>
Date:   Thu,  4 Feb 2016 19:50:30 +0100

Move platform spec. macros from *.mk to xbattmon.c

Diffstat:
Mconfig.bsd.mk | 2+-
Mconfig.dfly.mk | 2+-
Mconfig.linux.mk | 3+--
Mxbattmon.c | 7+++++++
4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/config.bsd.mk b/config.bsd.mk @@ -1,7 +1,7 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/man -CPPFLAGS = -DVERSION=\"${VERSION}\" -DPATH_APM=\"/dev/apm\" +CPPFLAGS = -DVERSION=\"${VERSION}\" CFLAGS = -I/usr/X11R6/include LDFLAGS = -L/usr/X11R6/lib LDLIBS = -lX11 diff --git a/config.dfly.mk b/config.dfly.mk @@ -1,7 +1,7 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/man -CPPFLAGS = -DVERSION=\"${VERSION}\" -DPATH_APM=\"/dev/apm\" +CPPFLAGS = -DVERSION=\"${VERSION}\" CFLAGS = -I/usr/local/include ${CPPFLAGS} LDFLAGS = -L/usr/local/lib LDLIBS = -lX11 diff --git a/config.linux.mk b/config.linux.mk @@ -1,6 +1,5 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man -CPPFLAGS = -DVERSION=\"${VERSION}\" -DPATH_BAT_CAP=\"/sys/class/power_supply/BAT0/capacity\" \ - -DPATH_AC_ONLINE=\"/sys/class/power_supply/AC/online\" +CPPFLAGS = -DVERSION=\"${VERSION}\" LDLIBS = -lX11 diff --git a/xbattmon.c b/xbattmon.c @@ -216,6 +216,8 @@ redraw(void) #include <fcntl.h> #include <machine/apmvar.h> +#define PATH_APM "/dev/apm" + void pollbat(void) { @@ -245,6 +247,8 @@ pollbat(void) #include <fcntl.h> #include <machine/apm_bios.h> +#define PATH_APM "/dev/apm" + void pollbat(void) { @@ -265,6 +269,9 @@ pollbat(void) close(fd); } #elif __linux__ +#define PATH_BAT_CAP "/sys/class/power_supply/BAT0/capacity" +#define PATH_AC_ONLINE "/sys/class/power_supply/AC/online" + void pollbat(void) {