diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-02-07 13:30:18 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-02-07 13:30:18 +0000 |
commit | d2e1fab1c1884d2b52a8d0ce7a62ca22b0612229 (patch) | |
tree | 717ea3c170726b6cc3cd52b5ce9d8c765a18e562 /usr.sbin/relayd | |
parent | 0dd18a7d99ace8598386e9c2f2640b28fec15f9c (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/relayd')
-rw-r--r-- | usr.sbin/relayd/parse.y | 3 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.8 | 14 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.c | 9 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.h | 3 |
4 files changed, 23 insertions, 6 deletions
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y index 22740086ce0..9d9ea912914 100644 --- a/usr.sbin/relayd/parse.y +++ b/usr.sbin/relayd/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 *); diff --git a/usr.sbin/relayd/relayd.8 b/usr.sbin/relayd/relayd.8 index 9988e416086..d708132debc 100644 --- a/usr.sbin/relayd/relayd.8 +++ b/usr.sbin/relayd/relayd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: relayd.8,v 1.5 2007/01/09 13:50:11 pyr Exp $ +.\" $OpenBSD: relayd.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/relayd/relayd.c b/usr.sbin/relayd/relayd.c index 2cd50aad40c..e0aa22192fe 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.14 2007/02/06 10:03:08 reyk Exp $ */ +/* $OpenBSD: relayd.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/relayd/relayd.h b/usr.sbin/relayd/relayd.h index 12e4d389390..2e2b94381f2 100644 --- a/usr.sbin/relayd/relayd.h +++ b/usr.sbin/relayd/relayd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.h,v 1.21 2007/02/06 10:26:13 pyr Exp $ */ +/* $OpenBSD: relayd.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); |