Index: config.h =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/config.h,v retrieving revision 1.52 diff -u -p -r1.52 config.h --- config.h 15 Feb 2003 02:26:13 -0000 1.52 +++ config.h 25 Apr 2004 22:47:57 -0000 @@ -54,6 +54,11 @@ struct file_list { char *f_warn; /* warning message */ }; +struct files_name { + char *f_name; + STAILQ_ENTRY(files_name) f_next; +}; + /* * Types. */ @@ -155,6 +160,8 @@ extern int yyline; extern const char *yyfile; extern STAILQ_HEAD(file_list_head, file_list) ftab; + +extern STAILQ_HEAD(files_name_head, files_name) fntab; extern int profiling; extern int debugging; Index: config.y =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/config.y,v retrieving revision 1.62 diff -u -p -r1.62 config.y --- config.y 14 Nov 2003 11:23:25 -0000 1.62 +++ config.y 26 Apr 2004 09:49:29 -0000 @@ -22,6 +22,7 @@ %token NOMAKEOPTION %token SEMICOLON %token INCLUDE +%token FILES %token ID %token NUMBER @@ -84,6 +85,7 @@ int hintmode; int yyline; const char *yyfile; struct file_list_head ftab; +struct files_name_head fntab; char errbuf[80]; int maxusers; @@ -121,6 +123,9 @@ Spec: INCLUDE ID SEMICOLON = { include($2, 0); }; | + FILES ID SEMICOLON + = { newfile($2); }; + | SEMICOLON | error SEMICOLON @@ -275,6 +280,20 @@ yyerror(const char *s) errx(1, "%s:%d: %s", yyfile, yyline + 1, s); } +/* + * Add a new file to the list of files. + */ +static void +newfile(char *name) +{ + struct files_name *nl; + + nl = (struct files_name *) malloc(sizeof *nl); + bzero(nl, sizeof *nl); + nl->f_name = name; + STAILQ_INSERT_TAIL(&fntab, nl, f_next); +} + /* * add a device to the list of devices */ Index: configvers.h =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/configvers.h,v retrieving revision 1.31 diff -u -p -r1.31 configvers.h --- configvers.h 15 Apr 2003 21:29:11 -0000 1.31 +++ configvers.h 26 Apr 2004 09:44:02 -0000 @@ -8,4 +8,4 @@ * * $FreeBSD: src/usr.sbin/config/configvers.h,v 1.31 2003/04/15 21:29:11 phk Exp $ */ -#define CONFIGVERS 500012 +#define CONFIGVERS 500013 Index: lang.l =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/lang.l,v retrieving revision 1.35 diff -u -p -r1.35 lang.l --- lang.l 26 Feb 2003 23:36:58 -0000 1.35 +++ lang.l 25 Apr 2004 21:55:03 -0000 @@ -80,6 +80,7 @@ struct kt { { "options", OPTIONS }, { "nooption", NOOPTION }, { "include", INCLUDE }, + { "files", FILES }, { 0, 0 }, }; Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/main.c,v retrieving revision 1.58 diff -u -p -r1.58 main.c --- main.c 12 Jun 2003 11:36:54 -0000 1.58 +++ main.c 25 Apr 2004 22:39:42 -0000 @@ -145,7 +145,9 @@ main(int argc, char **argv) errx(2, "%s isn't a directory", p); STAILQ_INIT(&dtab); + STAILQ_INIT(&fntab); SLIST_INIT(&cputype); + STAILQ_INIT(&ftab); yyfile = *argv; if (yyparse()) exit(3); Index: mkmakefile.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/config/mkmakefile.c,v retrieving revision 1.77 diff -u -p -r1.77 mkmakefile.c --- mkmakefile.c 16 Jun 2003 20:08:15 -0000 1.77 +++ mkmakefile.c 26 Apr 2004 09:50:24 -0000 @@ -293,29 +293,17 @@ makefile(void) moveifchanged(path("env.c.new"), path("env.c")); } -/* - * Read in the information about files used in making the system. - * Store it in the ftab linked list. - */ -static void -read_files(void) +void +read_file(char *fname) { FILE *fp; struct file_list *tp, *pf; struct device *dp; struct opt *op; char *wd, *this, *needs, *compilewith, *depends, *clean, *warning; - char fname[MAXPATHLEN]; - int nreqs, first = 1, isdup, std, filetype, + int nreqs, isdup, std, filetype, imp_rule, no_obj, needcount, before_depend, mandatory, nowerror; - STAILQ_INIT(&ftab); - 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); @@ -330,19 +318,8 @@ next: wd = get_word(fp); if (wd == (char *)EOF) { (void) fclose(fp); - if (first == 1) { - 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; - } return; - } + } if (wd == 0) goto next; if (wd[0] == '#') @@ -555,6 +532,34 @@ doneparam: if (pf && pf->f_type == INVISIBLE) pf->f_flags |= ISDUP; /* mark as duplicate */ goto next; +} + +/* + * Read in the information about files used in making the system. + * Store it in the ftab linked list. + */ +static void +read_files(void) +{ + char fname[MAXPATHLEN]; + FILE *fp; + 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), + "../../conf/files.%s", machinename); + read_file(fname); + for (nl = STAILQ_FIRST(&fntab); nl != NULL; nl = tnl) { + read_file(nl->f_name); + tnl = STAILQ_NEXT(nl, f_next); + free(nl->f_name); + free(nl); + } } static int