From 2b5aa29ad6697b1821fadeb95554a73fca00e38b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 6 Mar 2015 19:19:11 +0000 Subject: [PATCH] readglobalconfig: Support Include Signed-off-by: Ian Jackson --- Osstest.pm | 9 ++++++++- README | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Osstest.pm b/Osstest.pm index 8e63389..9fbadbd 100644 --- a/Osstest.pm +++ b/Osstest.pm @@ -20,6 +20,7 @@ use strict; use warnings; use POSIX; +use File::Basename; BEGIN { use Exporter (); @@ -120,7 +121,13 @@ sub readglobalconfig () { s/\s+$//; next if m/^\#/; next unless m/\S/; - if (m/^($cfgvar_re)\s+(\S.*)$/) { + if (m/^include\s+(\S.*)$/i) { + my $newfn = $1; + if ($newfn !~ m#^/|^\./#) { + $newfn = dirname($cfgfile)."/".$newfn; + } + $readcfg->($newfn, 0); + } elsif (m/^($cfgvar_re)\s+(\S.*)$/) { $c{$1} = $2; } elsif (m/^($cfgvar_re)=\s*\<\<(\'?)(.*)\2\s*$/) { my ($vn,$qu,$delim) = ($1,$2,$3); diff --git a/README b/README index 9634185..0aaba2c 100644 --- a/README +++ b/README @@ -276,6 +276,9 @@ To set a value to the empty string, say For an example see ./standalone-config-example Values later in the file, or in a later file, take precedence. +You can say `Include '. is relative to the file +doing the including, unless it starts with `/' or `./'. + ======================================== Important config settings for standalone mode: -- 2.39.5