From a584b423450923389f4dc25480e30472c8641d38 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 22 Sep 2006 17:07:17 -0700 Subject: [PATCH] Try to be more true to the way "MENU INCLUDE" should work. --- com32/modules/readconfig.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/com32/modules/readconfig.c b/com32/modules/readconfig.c index 33326f6..a0a7842 100644 --- a/com32/modules/readconfig.c +++ b/com32/modules/readconfig.c @@ -362,19 +362,19 @@ static uint32_t parse_argb(char **p) } /* - * Global APPEND and IPAPPEND status + * Parser state. This is global so that including multiple + * files work as expected, which is that everything works the + * same way as if the files had been concatenated together. */ static char *append = NULL; static unsigned int ipappend = 0; +static struct labeldata ld; static int parse_one_config(const char *filename); static void parse_config_file(FILE *f) { char line[MAX_LINE], *p, *ep, ch; - struct labeldata ld; - - memset(&ld, 0, sizeof ld); while ( fgets(line, sizeof line, f) ) { p = strchr(line, '\r'); @@ -515,8 +515,6 @@ static void parse_config_file(FILE *f) ld.append = strdup(skipspace(p+9)); } } - - record(&ld, append); } static int parse_one_config(const char *filename) @@ -549,6 +547,10 @@ void parse_configs(char **argv) parse_one_config(filename); } + /* On final EOF process the last label statement */ + + record(&ld, append); + /* Common postprocessing */ if ( ontimeout ) -- 2.7.4