diff options
author | Peter Wemm <peter@FreeBSD.org> | 2002-07-21 22:23:56 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2002-07-21 22:23:56 +0000 |
commit | 775d6c0ecedf60a453873d04ed2cdd4070f10f3e (patch) | |
tree | 277380e6665b96f6a87496888ba5d3d49c4373e7 /usr.sbin | |
parent | 995e4431de547694c3a846f9abfa4ccf84dbe3f0 (diff) | |
download | src-775d6c0ecedf60a453873d04ed2cdd4070f10f3e.tar.gz src-775d6c0ecedf60a453873d04ed2cdd4070f10f3e.zip |
Check that we are not supplying 'device foo N' to devices that do not take
a statuc unit count.
Notes
Notes:
svn path=/head/; revision=100461
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/config/mkheaders.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/usr.sbin/config/mkheaders.c b/usr.sbin/config/mkheaders.c index bc30f55ef3ca..ddd3337a1863 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 |