summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-07-21 22:23:56 +0000
committerpeter <peter@FreeBSD.org>2002-07-21 22:23:56 +0000
commit75dc92e250d10b657db6db78638389f63c9bca94 (patch)
tree277380e6665b96f6a87496888ba5d3d49c4373e7 /usr.sbin
parent8d0a6e2bb6d41fdd5972c6b2dd19bc47912099d9 (diff)
downloadFreeBSD-src-75dc92e250d10b657db6db78638389f63c9bca94.zip
FreeBSD-src-75dc92e250d10b657db6db78638389f63c9bca94.tar.gz
Check that we are not supplying 'device foo N' to devices that do not take
a statuc unit count.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/config/mkheaders.c29
1 files changed, 27 insertions, 2 deletions
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
OpenPOWER on IntegriCloud