xbattmon

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

commit 89188ecc9c9d81e1cab033fba4057fd5089eb79d
parent 0744de52c92a1f7e365bc3c32a275fe9953af514
Author: sin <sin@2f30.org>
Date:   Mon, 10 Nov 2014 17:56:34 +0000

Add -v to show version

Diffstat:
MMakefile | 2++
Mconfig.bsd.mk | 2+-
Mconfig.linux.mk | 2+-
Mxbattmon.1 | 5++++-
Mxbattmon.c | 6+++++-
5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,3 +1,5 @@ +VERSION=0.5 + include config.mk OBJ = xbattmon.o diff --git a/config.bsd.mk b/config.bsd.mk @@ -1,7 +1,7 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/man -CPPFLAGS = -DPATH_APM='"/dev/apm"' +CPPFLAGS = -DVERSION=\"${VERSION}\" -DPATH_APM='"/dev/apm"' CFLAGS = -I/usr/X11R6/include LDFLAGS = -L/usr/X11R6/lib LDLIBS = -lX11 diff --git a/config.linux.mk b/config.linux.mk @@ -1,6 +1,6 @@ PREFIX = /usr/local MANPREFIX = $(PREFIX)/man -CPPFLAGS = -DPATH_BAT_CAP='"/sys/class/power_supply/BAT0/capacity"' \ +CPPFLAGS = -DVERSION=\"${VERSION}\" -DPATH_BAT_CAP='"/sys/class/power_supply/BAT0/capacity"' \ -DPATH_AC_ONLINE='"/sys/class/power_supply/AC/online"' LDLIBS = -lX11 -lbsd diff --git a/xbattmon.1 b/xbattmon.1 @@ -1,4 +1,4 @@ -.Dd Nov 9, 2014 +.Dd Nov 10, 2014 .Dt XBATTMON 1 .Os .Sh NAME @@ -10,6 +10,7 @@ .Op Fl i Ar interval .Op Fl p Ar bottom | top | left | right .Op Fl t Ar thickness +.Op Fl v .Sh DESCRIPTION .Nm is a simple battery monitor. By default @@ -26,6 +27,8 @@ Set the battery poll interval in seconds. Set the bar placement. .It Fl t Ar thickness Set the bar thickness. +.It Fl v +Show program version. .El .Sh CONFIGURATION You can tweak the colors diff --git a/xbattmon.c b/xbattmon.c @@ -265,11 +265,12 @@ loop(void) void usage(void) { - fprintf(stderr, "usage: %s [-c capacity] [-i interval] [-p bottom | top | left | right] [-t thickness]\n", argv0); + fprintf(stderr, "usage: %s [-c capacity] [-i interval] [-p bottom | top | left | right] [-t thickness] [-v]\n", argv0); fprintf(stderr, " -c\tspecify battery capacity\n"); fprintf(stderr, " -i\tbattery poll interval in seconds\n"); fprintf(stderr, " -p\tbar placement\n"); fprintf(stderr, " -t\tbar thickness\n"); + fprintf(stderr, " -v\tshow version\n"); exit(1); } @@ -311,6 +312,9 @@ main(int argc, char *argv[]) if (errstr) errx(1, "%s: %s", arg, errstr); break; + case 'v': + printf("xbattmon-%s\n", VERSION); + return 0; default: usage(); } ARGEND;