diff options
-rw-r--r-- | usr.sbin/ifstated/ifstated.c | 18 | ||||
-rw-r--r-- | usr.sbin/ifstated/ifstated.h | 3 | ||||
-rw-r--r-- | usr.sbin/ifstated/parse.y | 3 |
3 files changed, 16 insertions, 8 deletions
diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c index 73a1307a2a6..5d78bcabe7b 100644 --- a/usr.sbin/ifstated/ifstated.c +++ b/usr.sbin/ifstated/ifstated.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifstated.c,v 1.2 2004/02/04 23:47:49 mcbride Exp $ */ +/* $OpenBSD: ifstated.c,v 1.3 2004/02/05 02:18:55 mcbride Exp $ */ /* * Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org> @@ -87,7 +87,7 @@ void remove_expression(struct ifsd_expression *, struct ifsd_state *); void usage(void) { - fprintf(stderr, "usage: ifstated [-hdi] [-f config]\n"); + fprintf(stderr, "usage: ifstated [-dhinv] [-f config]\n"); exit(1); } @@ -98,7 +98,7 @@ main(int argc, char *argv[]) int rt_fd, ch; struct timeval tv; - while ((ch = getopt(argc, argv, "dD:f:hi")) != -1) { + while ((ch = getopt(argc, argv, "dD:f:hniv")) != -1) { switch (ch) { case 'd': opt_debug = 1; @@ -114,6 +114,9 @@ main(int argc, char *argv[]) case 'h': usage(); break; + case 'n': + conf.opts |= IFSD_OPT_NOACTION; + break; case 'i': opt_inhibit = 1; break; @@ -129,9 +132,12 @@ main(int argc, char *argv[]) event_init(); - if (parse_config(configfile, &conf) != 0) - errx(1, NULL); - + if (conf.opts & IFSD_OPT_NOACTION) { + if (parse_config(configfile, &conf) != 0) + exit(1); + printf("configuration OK\n"); + exit(0); + } if (!opt_debug) { daemon(0, 0); diff --git a/usr.sbin/ifstated/ifstated.h b/usr.sbin/ifstated/ifstated.h index 3998fe5afdb..cfb4e176eb0 100644 --- a/usr.sbin/ifstated/ifstated.h +++ b/usr.sbin/ifstated/ifstated.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ifstated.h,v 1.1 2004/02/04 23:47:49 mcbride Exp $ */ +/* $OpenBSD: ifstated.h,v 1.2 2004/02/05 02:18:55 mcbride Exp $ */ /* * Copyright (c) 2004 Ryan McBride @@ -127,6 +127,7 @@ struct ifsd_config { u_int32_t opts; #define IFSD_OPT_VERBOSE 0x00000001 #define IFSD_OPT_VERBOSE2 0x00000002 +#define IFSD_OPT_NOACTION 0x00000004 int maxdepth; u_int8_t loglevel; #define IFSD_LOG_NONE 0 diff --git a/usr.sbin/ifstated/parse.y b/usr.sbin/ifstated/parse.y index 918491bf94a..6ddd2096695 100644 --- a/usr.sbin/ifstated/parse.y +++ b/usr.sbin/ifstated/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.1 2004/02/04 23:47:49 mcbride Exp $ */ +/* $OpenBSD: parse.y,v 1.2 2004/02/05 02:18:55 mcbride Exp $ */ /* * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org> @@ -614,6 +614,7 @@ parse_config(char *filename, struct ifsd_config *xconf) init_state(&conf->always); curaction = conf->always.always; conf->loglevel = IFSD_LOG_NORMAL; + conf->opts = xconf->opts; if ((fin = fopen(filename, "r")) == NULL) { warn("%s", filename); |