xref: /freebsd/usr.sbin/config/mkheaders.c (revision 8a16b7a18f5d0b031f09832fd7752fba717e2a97)
1*8a16b7a1SPedro F. Giffuni /*-
2*8a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*8a16b7a1SPedro F. Giffuni  *
4dea673e9SRodney W. Grimes  * Copyright (c) 1980, 1993
5dea673e9SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
6dea673e9SRodney W. Grimes  *
7dea673e9SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
8dea673e9SRodney W. Grimes  * modification, are permitted provided that the following conditions
9dea673e9SRodney W. Grimes  * are met:
10dea673e9SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
11dea673e9SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
12dea673e9SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
13dea673e9SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
14dea673e9SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
15fbbd9655SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
16dea673e9SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
17dea673e9SRodney W. Grimes  *    without specific prior written permission.
18dea673e9SRodney W. Grimes  *
19dea673e9SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20dea673e9SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21dea673e9SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22dea673e9SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23dea673e9SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24dea673e9SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25dea673e9SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26dea673e9SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27dea673e9SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28dea673e9SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29dea673e9SRodney W. Grimes  * SUCH DAMAGE.
30dea673e9SRodney W. Grimes  */
31dea673e9SRodney W. Grimes 
32dea673e9SRodney W. Grimes #ifndef lint
33d5831691SPhilippe Charnier #if 0
34dea673e9SRodney W. Grimes static char sccsid[] = "@(#)mkheaders.c	8.1 (Berkeley) 6/6/93";
35d5831691SPhilippe Charnier #endif
36d5831691SPhilippe Charnier static const char rcsid[] =
3797d92980SPeter Wemm   "$FreeBSD$";
38dea673e9SRodney W. Grimes #endif /* not lint */
39dea673e9SRodney W. Grimes 
40dea673e9SRodney W. Grimes /*
41dea673e9SRodney W. Grimes  * Make all the .h files for the optional entries
42dea673e9SRodney W. Grimes  */
43dea673e9SRodney W. Grimes 
44d5831691SPhilippe Charnier #include <ctype.h>
45d5831691SPhilippe Charnier #include <err.h>
46dea673e9SRodney W. Grimes #include <stdio.h>
475bd7b809SJoerg Wunsch #include <string.h>
48faa913d7SWarner Losh #include <sys/param.h>
49dea673e9SRodney W. Grimes #include "config.h"
501d95dc91SPoul-Henning Kamp #include "y.tab.h"
51dea673e9SRodney W. Grimes 
52d5831691SPhilippe Charnier void
53f71c01ccSPeter Wemm headers(void)
54dea673e9SRodney W. Grimes {
55cea24a2bSJoerg Wunsch 	struct device *dp;
56775d6c0eSPeter Wemm 	int errors;
57dea673e9SRodney W. Grimes 
58775d6c0eSPeter Wemm 	errors = 0;
59292dd8a8SRuslan Ermilov 	STAILQ_FOREACH(dp, &dtab, d_next) {
60775d6c0eSPeter Wemm 		if (!(dp->d_done & DEVDONE)) {
61775d6c0eSPeter Wemm 			warnx("Error: device \"%s\" is unknown",
62ed7e72e6SPeter Wemm 			       dp->d_name);
63775d6c0eSPeter Wemm 			       errors++;
64952017beSPeter Wemm 			}
65775d6c0eSPeter Wemm 	}
66775d6c0eSPeter Wemm 	if (errors)
67775d6c0eSPeter Wemm 		errx(1, "%d errors", errors);
68ed7e72e6SPeter Wemm }
69