From 58b2c604d8ba4ce0adc25b6de1fc31b115c4b09d Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Tue, 21 Jan 2014 16:52:05 -0800 Subject: [PATCH] Add configuration include file support. --- options.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/options.c b/options.c index 1030ba4..a4e759c 100644 --- a/options.c +++ b/options.c @@ -90,12 +90,6 @@ readoptionsfile(const char * fname) if(!(hfile = fopen(fname, "r"))) return -1; - if(ary_options != NULL) - { - free(ary_options); - num_options = 0; - } - while(fgets(buffer, sizeof(buffer), hfile)) { linenum++; @@ -152,8 +146,11 @@ readoptionsfile(const char * fname) if(id == UPNP_INVALID) { - fprintf(stderr, "parsing error file %s line %d : %s=%s\n", - fname, linenum, name, value); + if (strcmp(name, "include") == 0) + readoptionsfile(value); + else + fprintf(stderr, "parsing error file %s line %d : %s=%s\n", + fname, linenum, name, value); } else {