From 340936b70bdb4f940477575096982f8c30f45acd Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 24 Oct 2006 00:31:59 +0000 Subject: 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). --- usr.sbin/config/mkmakefile.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'usr.sbin/config/mkmakefile.c') 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) -- cgit v1.1