commit fcb10f066161aed8dbc74f8c80733ff7b5ffb47b
parent b3b271b9f280a56f92f17aa5df14d30373ef5dc1
Author: sin <sin@2f30.org>
Date: Sat, 1 Nov 2014 12:57:37 +0000
Limit poll interval between [1, 60] seconds
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xbattmon.c b/xbattmon.c
@@ -213,7 +213,7 @@ void
usage(void)
{
fprintf(stderr, "usage: %s [-i interval] [-t thickness]\n", argv0);
- fprintf(stderr, " -i\tbattery poll interval\n");
+ fprintf(stderr, " -i\tbattery poll interval in seconds\n");
fprintf(stderr, " -t\tbar thickness\n");
exit(1);
}
@@ -227,7 +227,7 @@ main(int argc, char *argv[])
ARGBEGIN {
case 'i':
arg = EARGF(usage());
- pollinterval = strtonum(arg, 0, INT_MAX, &errstr);
+ pollinterval = strtonum(arg, 1, 60, &errstr);
if (errstr)
errx(1, "%s: %s", arg, errstr);
break;