From c714ed458538bef1f027e8ae35e11b74a934599f Mon Sep 17 00:00:00 2001 From: peter Date: Sat, 8 Jan 2000 16:48:12 +0000 Subject: [PATCH] Support getting *.$MACHINE from sys/conf as well as sys/$MACHINE/conf. This would mean that we could move files.alpha, files.i386, files.pc98 etc all next to conf/files, and the various Makefiles next to each other. This should go a long way towards committers "seeing" the Alpha etc stuff and remembering to update that too as it would be right next to the i386 config files. Note this does not include the GENERIC etc files as they can't be shared. I haven't actually moved the files, but the support is here for it. It still supports the per-machine conf directories so that folks working on a new arch can just distribute a subdir of files. --- usr.sbin/config/mkmakefile.c | 23 +++++++++++++++-------- usr.sbin/config/mkoptions.c | 16 ++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 868ea85bae4..0dc5d036a31 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -144,9 +144,12 @@ makefile() int versreq; read_files(); - strcpy(line, "Makefile."); - (void) strcat(line, machinename); + snprintf(line, sizeof(line), "../../conf/Makefile.%s", machinename); ifp = fopen(line, "r"); + if (ifp == 0) { + snprintf(line, sizeof(line), "Makefile.%s", machinename); + ifp = fopen(line, "r"); + } if (ifp == 0) err(1, "%s", line); ofp = fopen(path("Makefile.new"), "w"); @@ -255,15 +258,15 @@ read_files() ftab = 0; save_dp = NULL; + if (ident == NULL) { + printf("no ident line specified\n"); + exit(1); + } (void) snprintf(fname, sizeof fname, "../../conf/files"); openit: fp = fopen(fname, "r"); if (fp == 0) err(1, "%s", fname); - if (ident == NULL) { - printf("no ident line specified\n"); - exit(1); - } next: /* * filename [ standard | mandatory | optional ] [ config-dependent ] @@ -276,13 +279,17 @@ read_files() if (wd == (char *)EOF) { (void) fclose(fp); if (first == 1) { - (void) snprintf(fname, sizeof fname, "files.%s", machinename); first++; + (void) snprintf(fname, sizeof fname, "../../conf/files.%s", machinename); + fp = fopen(fname, "r"); + if (fp != 0) + goto next; + (void) snprintf(fname, sizeof fname, "files.%s", machinename); goto openit; } if (first == 2) { - (void) snprintf(fname, sizeof fname, "files.%s", raisestr(ident)); first++; + (void) snprintf(fname, sizeof fname, "files.%s", raisestr(ident)); fp = fopen(fname, "r"); if (fp != 0) goto next; diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index a6f44eb3faf..d8e4dbb0330 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -290,28 +290,32 @@ read_options() char genopt[80]; otab = 0; + if (ident == NULL) { + printf("no ident line specified\n"); + exit(1); + } (void) snprintf(fname, sizeof fname, "../../conf/options"); openit: fp = fopen(fname, "r"); if (fp == 0) { return; } - if (ident == NULL) { - printf("no ident line specified\n"); - exit(1); - } next: wd = get_word(fp); if (wd == (char *)EOF) { (void) fclose(fp); if (first == 1) { - (void) snprintf(fname, sizeof fname, "options.%s", machinename); first++; + (void) snprintf(fname, sizeof fname, "../../conf/options.%s", machinename); + fp = fopen(fname, "r"); + if (fp != 0) + goto next; + (void) snprintf(fname, sizeof fname, "options.%s", machinename); goto openit; } if (first == 2) { - (void) snprintf(fname, sizeof fname, "options.%s", raisestr(ident)); first++; + (void) snprintf(fname, sizeof fname, "options.%s", raisestr(ident)); fp = fopen(fname, "r"); if (fp != 0) goto next; -- 2.45.2