Added rudimentary support for the "include" directive (inside "files").

This will be used to split sys/conf/files into multiple files similar
to how this is done in NetBSD.
This commit is contained in:
Ruslan Ermilov 2006-10-01 17:17:29 +00:00
parent 457ce4c37b
commit d9fb65c84d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162936
2 changed files with 15 additions and 1 deletions

View File

@ -49,5 +49,5 @@
*
* $FreeBSD$
*/
#define CONFIGVERS 600004
#define CONFIGVERS 600005
#define MAJOR_VERS(x) ((x) / 100000)

View File

@ -305,6 +305,7 @@ makeenv(void)
static void
read_file(char *fname)
{
char ifname[MAXPATHLEN];
FILE *fp;
struct file_list *tp;
struct device *dp;
@ -318,6 +319,7 @@ read_file(char *fname)
err(1, "%s", fname);
next:
/*
* include "filename"
* filename [ standard | mandatory | optional ]
* [ dev* [ | dev* ... ] | profiling-routine ] [ no-obj ]
* [ compile-with "compile rule" [no-implicit-rule] ]
@ -337,6 +339,18 @@ read_file(char *fname)
;
goto next;
}
if (eq(wd, "include")) {
next_quoted_word(fp, wd);
if (wd == 0) {
printf("%s: missing include filename.\n", fname);
exit(1);
}
(void) snprintf(ifname, sizeof(ifname), "../../%s", wd);
read_file(ifname);
while (((wd = get_word(fp)) != (char *)EOF) && wd)
;
goto next;
}
this = ns(wd);
next_word(fp, wd);
if (wd == 0) {