From 75dc92e250d10b657db6db78638389f63c9bca94 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 21 Jul 2002 22:23:56 +0000 Subject: Check that we are not supplying 'device foo N' to devices that do not take a statuc unit count. --- usr.sbin/config/mkheaders.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c index bc30f55..ddd3337 100644 --- a/usr.sbin/config/mkheaders.c +++ b/usr.sbin/config/mkheaders.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include "y.tab.h" static void do_header(char *, int); +static void nocount(char *); static char *toheader(char *); static char *tomacro(char *); @@ -61,7 +62,9 @@ headers(void) struct file_list *fl; struct device *dp; int match; + int errors; + errors = 0; for (fl = ftab; fl != 0; fl = fl->f_next) { if (fl->f_needs != 0) { match = 0; @@ -76,10 +79,32 @@ headers(void) } } for (dp = dtab; dp != 0; dp = dp->d_next) { - if (!(dp->d_done & DEVDONE)) - errx(1, "Error: device \"%s\" is unknown", + if (!(dp->d_done & DEVDONE)) { + warnx("Error: device \"%s\" is unknown", dp->d_name); + errors++; + } + if (dp->d_count == UNKNOWN) + continue; + match = 0; + for (fl = ftab; fl != 0; fl = fl->f_next) { + if (fl->f_needs == 0) + continue; + if ((fl->f_flags & NEED_COUNT) == 0) + continue; + if (eq(dp->d_name, fl->f_needs)) { + match++; + break; + } + } + if (match == 0) { + warnx("Error: device \"%s\" does not take a count", + dp->d_name); + errors++; + } } + if (errors) + errx(1, "%d errors", errors); } static void -- cgit v1.1