From 9d1801a10554429dd1cfce2268b2f14d02e25509 Mon Sep 17 00:00:00 2001 From: ru Date: Fri, 30 Dec 2005 15:29:50 +0000 Subject: Clean up most of the "XXX"-tagged items: - The code that creates hints.c and env.c from the skeleton files moved into separate functions. - Sanity checks for missing "ident" and "cputype" directives moved into main(), alongside the existing check for "machine". PR: bin/90310 Submitted by: Matt Emmerton --- usr.sbin/config/mkmakefile.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'usr.sbin/config/mkmakefile.c') diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 9ef2adf..157cff6 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -113,7 +113,6 @@ makefile(void) char line[BUFSIZ]; struct opt *op; int versreq; - char *s; read_files(); snprintf(line, sizeof(line), "../../conf/Makefile.%s", machinename); @@ -125,12 +124,6 @@ makefile(void) if (ifp == 0) err(1, "%s", line); - /* XXX this check seems to be misplaced. */ - if (SLIST_EMPTY(&cputype)) { - printf("cpu type must be specified\n"); - exit(1); - } - ofp = fopen(path("Makefile.new"), "w"); if (ofp == 0) err(1, "%s", path("Makefile.new")); @@ -181,8 +174,18 @@ makefile(void) (void) fclose(ifp); (void) fclose(ofp); moveifchanged(path("Makefile.new"), path("Makefile")); +} + +/* + * Build hints.c from the skeleton + */ +void +makehints(void) +{ + FILE *ifp, *ofp; + char line[BUFSIZ]; + char *s; - /* XXX makefile() should make the Makefile, not hints.c. */ if (hints) { ifp = fopen(hints, "r"); if (ifp == NULL) @@ -234,8 +237,18 @@ makefile(void) fclose(ifp); fclose(ofp); moveifchanged(path("hints.c.new"), path("hints.c")); +} + +/* + * Build env.c from the skeleton + */ +void +makeenv(void) +{ + FILE *ifp, *ofp; + char line[BUFSIZ]; + char *s; - /* XXX makefile() should make the Makefile, not env.c. */ if (env) { ifp = fopen(env, "r"); if (ifp == NULL) @@ -518,10 +531,6 @@ read_files(void) char fname[MAXPATHLEN]; struct files_name *nl, *tnl; - if (ident == NULL) { - printf("no ident line specified\n"); - exit(1); - } (void) snprintf(fname, sizeof(fname), "../../conf/files"); read_file(fname); (void) snprintf(fname, sizeof(fname), -- cgit v1.1