diff options
author | peter <peter@FreeBSD.org> | 2000-01-08 16:48:12 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-01-08 16:48:12 +0000 |
commit | c714ed458538bef1f027e8ae35e11b74a934599f (patch) | |
tree | 1477b047f8936f2d04b86998b48f0be6858d9b42 /usr.sbin/config | |
parent | 27629843b562745fcc1fe1d5d008fb30d613bb86 (diff) | |
download | FreeBSD-src-c714ed458538bef1f027e8ae35e11b74a934599f.zip FreeBSD-src-c714ed458538bef1f027e8ae35e11b74a934599f.tar.gz |
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.
Diffstat (limited to 'usr.sbin/config')
-rw-r--r-- | usr.sbin/config/mkmakefile.c | 23 | ||||
-rw-r--r-- | 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 868ea85..0dc5d03 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 @@ next: 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 a6f44eb..d8e4dbb 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; |