diff options
author | bde <bde@FreeBSD.org> | 1998-07-12 02:31:08 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-07-12 02:31:08 +0000 |
commit | 82ecca82af17fd6c172a75947a0c6cfbb255cdf6 (patch) | |
tree | 1f886b05cfbaef8ac1e55e254629ef987e91f680 | |
parent | aa863717b9318186635eba0c68827438ae6e38de (diff) | |
download | FreeBSD-src-82ecca82af17fd6c172a75947a0c6cfbb255cdf6.zip FreeBSD-src-82ecca82af17fd6c172a75947a0c6cfbb255cdf6.tar.gz |
Warn about redefined options. Keep using the last value processed.
Options are processed reverse file order, so the first definition in
the config file wins (except for directives that are converted to
option).
-rw-r--r-- | usr.sbin/config/mkoptions.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 16a2d8f..45e6780 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$Id$"; + "$Id: mkoptions.c,v 1.6 1997/09/15 06:37:10 charnier Exp $"; #endif /* not lint */ /* @@ -103,9 +103,15 @@ do_option(name) value = NULL; for (op = opt; op; op = op->op_next) { if (eq(name, op->op_name)) { + oldvalue = value; value = op->op_value; - if (!value) + if (value == NULL) value = ns("1"); + if (oldvalue != NULL && !eq(value, oldvalue)) + printf( + "%s:%d: option \"%s\" redefined from %s to %s\n", + PREFIX, op->op_line, op->op_name, oldvalue, + value); op->op_ownfile++; } } |