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.
This commit is contained in:
Peter Wemm 2000-01-08 16:48:12 +00:00
parent f26775b4f3
commit b5cda9cb3c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55614
2 changed files with 25 additions and 14 deletions

View File

@ -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;

View File

@ -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;