diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-03-20 15:31:24 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2017-03-20 15:31:24 +0000 |
commit | bf107d3c9a39291c0b99a564aa5f267e6bcd8f12 (patch) | |
tree | 3f1179b56bee973a7b1ce8841af8ccb69368527f /usr.sbin/sensorsd/sensorsd.c | |
parent | 5239fd114a45648292e8934f83c39a800e598262 (diff) |
Add command line option -f to specify alternative config file.
from Matthias Pitzl
Diffstat (limited to 'usr.sbin/sensorsd/sensorsd.c')
-rw-r--r-- | usr.sbin/sensorsd/sensorsd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c index 4c0750c6648..680bc8af9ad 100644 --- a/usr.sbin/sensorsd/sensorsd.c +++ b/usr.sbin/sensorsd/sensorsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensorsd.c,v 1.60 2016/08/27 01:50:07 guenther Exp $ */ +/* $OpenBSD: sensorsd.c,v 1.61 2017/03/20 15:31:23 bluhm Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -102,7 +102,8 @@ void usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-d] [-c check]\n", __progname); + fprintf(stderr, "usage: %s [-d] [-c check] [-f file]\n", + __progname); exit(1); } @@ -116,7 +117,7 @@ main(int argc, char *argv[]) if (pledge("stdio rpath proc exec", NULL) == -1) err(1, "pledge"); - while ((ch = getopt(argc, argv, "c:d")) != -1) { + while ((ch = getopt(argc, argv, "c:df:")) != -1) { switch (ch) { case 'c': check_period = strtonum(optarg, 1, 600, &errstr); @@ -126,6 +127,12 @@ main(int argc, char *argv[]) case 'd': debug = 1; break; + case 'f': + configfile = optarg; + if (access(configfile, R_OK) != 0) + err(1, "access configuration file %s", + configfile); + break; default: usage(); } |