commit 805c68a406d1d657003c03da4ce73f61bb8fd00d
parent 76c9afc7fb8eec3f1a5ccc2011247c4cb2704476
Author: sin <sin@2f30.org>
Date: Sat, 1 Nov 2014 15:12:26 +0000
Add flag to specify the maximum battery capacity
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/xbattmon.c b/xbattmon.c
@@ -212,7 +212,8 @@ again:
void
usage(void)
{
- fprintf(stderr, "usage: %s [-i interval] [-p bottom | top] [-t thickness]\n", argv0);
+ fprintf(stderr, "usage: %s [-c capacity] [-i interval] [-p bottom | top] [-t thickness]\n", argv0);
+ fprintf(stderr, " -c\tspecify batter capacity\n");
fprintf(stderr, " -i\tbattery poll interval in seconds\n");
fprintf(stderr, " -p\tbar placement\n");
fprintf(stderr, " -t\tbar thickness\n");
@@ -226,6 +227,12 @@ main(int argc, char *argv[])
const char *errstr;
ARGBEGIN {
+ case 'c':
+ arg = EARGF(usage());
+ maxcap = strtonum(arg, 1, 100, &errstr);
+ if (errstr)
+ errx(1, "%s: %s", arg, errstr);
+ break;
case 'i':
arg = EARGF(usage());
pollinterval = strtonum(arg, 1, 60, &errstr);