summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/mkmakefile.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2006-10-24 00:31:59 +0000
committerimp <imp@FreeBSD.org>2006-10-24 00:31:59 +0000
commit340936b70bdb4f940477575096982f8c30f45acd (patch)
treed2c2a39616e0e8222e96a33e03e28df657833fef /usr.sbin/config/mkmakefile.c
parent38fb98a99068cbc7a00d904df8f4a044c7e2652b (diff)
downloadFreeBSD-src-340936b70bdb4f940477575096982f8c30f45acd.zip
FreeBSD-src-340936b70bdb4f940477575096982f8c30f45acd.tar.gz
End my resistance to jmg's multiple hints files and bring in support
for having multiple hints files generate a correct hints.c (eg, with all the specified ones catenated together).
Diffstat (limited to 'usr.sbin/config/mkmakefile.c')
-rw-r--r--usr.sbin/config/mkmakefile.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 47a1db0..62603d5 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -182,17 +182,11 @@ makefile(void)
void
makehints(void)
{
- FILE *ifp, *ofp;
+ FILE *ifp = NULL, *ofp;
char line[BUFSIZ];
char *s;
+ struct hint *hint;
- if (hints) {
- ifp = fopen(hints, "r");
- if (ifp == NULL)
- err(1, "%s", hints);
- } else {
- ifp = NULL;
- }
ofp = fopen(path("hints.c.new"), "w");
if (ofp == NULL)
err(1, "%s", path("hints.c.new"));
@@ -201,7 +195,10 @@ makehints(void)
fprintf(ofp, "\n");
fprintf(ofp, "int hintmode = %d;\n", hintmode);
fprintf(ofp, "char static_hints[] = {\n");
- if (ifp) {
+ STAILQ_FOREACH(hint, &hints, hint_next) {
+ ifp = fopen(hint->hint_name, "r");
+ if (ifp == NULL)
+ err(1, "%s", hint->hint_name);
while (fgets(line, BUFSIZ, ifp) != 0) {
/* zap trailing CR and/or LF */
while ((s = rindex(line, '\n')) != NULL)
OpenPOWER on IntegriCloud