summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-03-20 15:31:23 +0000
committerbluhm <bluhm@openbsd.org>2017-03-20 15:31:23 +0000
commit017ace1e4d3709212ceab60563b013cdcf27c266 (patch)
treed1f6f4f77e7584eb1973c1c280b8c545683f62b9
parentsimplify example. list of ports variables was non-exahustive, which means (diff)
downloadwireguard-openbsd-017ace1e4d3709212ceab60563b013cdcf27c266.tar.xz
wireguard-openbsd-017ace1e4d3709212ceab60563b013cdcf27c266.zip
Add command line option -f to specify alternative config file.
from Matthias Pitzl
-rw-r--r--usr.sbin/sensorsd/sensorsd.810
-rw-r--r--usr.sbin/sensorsd/sensorsd.c13
2 files changed, 18 insertions, 5 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.8 b/usr.sbin/sensorsd/sensorsd.8
index c2e1e597636..d33e4d807f1 100644
--- a/usr.sbin/sensorsd/sensorsd.8
+++ b/usr.sbin/sensorsd/sensorsd.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sensorsd.8,v 1.22 2015/07/27 17:28:40 sobrado Exp $
+.\" $OpenBSD: sensorsd.8,v 1.23 2017/03/20 15:31:23 bluhm Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\" Copyright (c) 2005 Matthew Gream <matthew.gream@pobox.com>
@@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 27 2015 $
+.Dd $Mdocdate: March 20 2017 $
.Dt SENSORSD 8
.Os
.Sh NAME
@@ -26,6 +26,7 @@
.Nm sensorsd
.Op Fl d
.Op Fl c Ar check
+.Op Fl f Ar file
.Sh DESCRIPTION
The
.Nm
@@ -68,6 +69,11 @@ Do not daemonize.
If this option is specified,
.Nm
will run in the foreground.
+.It Fl f Ar file
+Read configuration from
+.Ar file
+instead of the default configuration file
+.Pa /etc/sensorsd.conf .
.El
.Sh FILES
.Bl -tag -width "/etc/sensorsd.conf"
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();
}