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).
This commit is contained in:
Bruce Evans 1998-07-12 02:31:08 +00:00
parent f59d2e0292
commit d8dd03ae32
1 changed files with 8 additions and 2 deletions

View File

@ -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++;
}
}