summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-02-07 13:30:18 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-02-07 13:30:18 +0000
commitd2e1fab1c1884d2b52a8d0ce7a62ca22b0612229 (patch)
tree717ea3c170726b6cc3cd52b5ce9d8c765a18e562 /usr.sbin/hoststated
parent0dd18a7d99ace8598386e9c2f2640b28fec15f9c (diff)
add the -D option to define macros on the command line (as found in
bgpd(8), hostapd(8), ipsecctl(8), pfctl(8), ...).
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r--usr.sbin/hoststated/hoststated.814
-rw-r--r--usr.sbin/hoststated/hoststated.c9
-rw-r--r--usr.sbin/hoststated/hoststated.h3
-rw-r--r--usr.sbin/hoststated/parse.y3
4 files changed, 23 insertions, 6 deletions
diff --git a/usr.sbin/hoststated/hoststated.8 b/usr.sbin/hoststated/hoststated.8
index f7d0f271aa2..fcde95a0337 100644
--- a/usr.sbin/hoststated/hoststated.8
+++ b/usr.sbin/hoststated/hoststated.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: hoststated.8,v 1.5 2007/01/09 13:50:11 pyr Exp $
+.\" $OpenBSD: hoststated.8,v 1.6 2007/02/07 13:30:17 reyk Exp $
.\"
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
.\"
@@ -23,6 +23,9 @@
.Sh SYNOPSIS
.Nm
.Op Fl dnv
+.Oo Xo
+.Fl D Ar macro Ns = Ns Ar value Oc
+.Xc
.Op Fl f Ar file
.Sh DESCRIPTION
.Nm
@@ -65,6 +68,15 @@ as showing the current status of each object.
.Pp
The options are as follows:
.Bl -tag -width Ds
+.It Fl D Ar macro Ns = Ns Ar value
+Define
+.Ar macro
+to be set to
+.Ar value
+on the command line.
+Overrides the definition of
+.Ar macro
+in the configuration file.
.It Fl d
Do not daemonize.
If this option is specified,
diff --git a/usr.sbin/hoststated/hoststated.c b/usr.sbin/hoststated/hoststated.c
index 0648bb3b31b..32aba7bfc10 100644
--- a/usr.sbin/hoststated/hoststated.c
+++ b/usr.sbin/hoststated/hoststated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.c,v 1.14 2007/02/06 10:03:08 reyk Exp $ */
+/* $OpenBSD: hoststated.c,v 1.15 2007/02/07 13:30:17 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -112,11 +112,16 @@ main(int argc, char *argv[])
conffile = CONF_FILE;
bzero(&env, sizeof (env));
- for (;(c = getopt(argc, argv, "dnf:v")) != -1;) {
+ for (;(c = getopt(argc, argv, "dD:nf:v")) != -1;) {
switch (c) {
case 'd':
debug = 1;
break;
+ case 'D':
+ if (cmdline_symset(optarg) < 0)
+ log_warnx("could not parse macro definition %s",
+ optarg);
+ break;
case 'n':
opts |= HOSTSTATED_OPT_NOACTION;
break;
diff --git a/usr.sbin/hoststated/hoststated.h b/usr.sbin/hoststated/hoststated.h
index 35a58e3e6a7..cf8272ba065 100644
--- a/usr.sbin/hoststated/hoststated.h
+++ b/usr.sbin/hoststated/hoststated.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hoststated.h,v 1.21 2007/02/06 10:26:13 pyr Exp $ */
+/* $OpenBSD: hoststated.h,v 1.22 2007/02/07 13:30:17 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -295,6 +295,7 @@ extern struct ctl_connlist ctl_conns;
/* parse.y */
int parse_config(struct hoststated *, const char *, int);
+int cmdline_symset(char *);
/* log.c */
void log_init(int);
diff --git a/usr.sbin/hoststated/parse.y b/usr.sbin/hoststated/parse.y
index 22740086ce0..9d9ea912914 100644
--- a/usr.sbin/hoststated/parse.y
+++ b/usr.sbin/hoststated/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.20 2007/01/30 10:12:06 pyr Exp $ */
+/* $OpenBSD: parse.y,v 1.21 2007/02/07 13:30:17 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -78,7 +78,6 @@ struct sym {
int symset(const char *, const char *, int);
char *symget(const char *);
-int cmdline_symset(char *);
struct address *host_v4(const char *);
struct address *host_v6(const char *);