diff options
author | des <des@FreeBSD.org> | 2005-11-14 13:32:30 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2005-11-14 13:32:30 +0000 |
commit | 837b3941899561014de2fd4b9b0f9757f14e77e8 (patch) | |
tree | a62e86f4a822c9099ab2eb8c5efafdfa77c220df /tools | |
parent | 8ec73786a5ddc7a7f5b8de614158c4c4a09fefd2 (diff) | |
download | FreeBSD-src-837b3941899561014de2fd4b9b0f9757f14e77e8.zip FreeBSD-src-837b3941899561014de2fd4b9b0f9757f14e77e8.tar.gz |
Add support for the += operator, which appends to a multiple-value variable.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tools/tinderbox/tbmaster.1 | 5 | ||||
-rw-r--r-- | tools/tools/tinderbox/tbmaster.pl | 20 |
2 files changed, 19 insertions, 6 deletions
diff --git a/tools/tools/tinderbox/tbmaster.1 b/tools/tools/tinderbox/tbmaster.1 index b9b256f..5d5f07d 100644 --- a/tools/tools/tinderbox/tbmaster.1 +++ b/tools/tools/tinderbox/tbmaster.1 @@ -84,8 +84,9 @@ used to specify default values shared by multiple configurations. The configuration consists of a list of single- or multiple-value variable assignments: .Bl -tag -.It Va variable = Ar value -.It Va variable = Ar value1 , Ar value2, ... +.It Va single_variable = Ar value +.It Va multi_variable = Ar value1 , Ar value2, ... +.It Va multi_variable += Ar value3 , ... .El .Pp Whitespace around the equal sign and around the commas separating diff --git a/tools/tools/tinderbox/tbmaster.pl b/tools/tools/tinderbox/tbmaster.pl index 71751a1..cfe8429 100644 --- a/tools/tools/tinderbox/tbmaster.pl +++ b/tools/tools/tinderbox/tbmaster.pl @@ -143,8 +143,8 @@ sub readconf($) { $line .= $_; if (length($line) && $line !~ s/\\$/ /) { die("$fn: syntax error on line $n\n") - unless ($line =~ m/^(\w+)\s*=\s*(.*)$/); - my ($key, $val) = (uc($1), $2); + unless ($line =~ m/^(\w+)\s*([+]?=)\s*(.*)$/); + my ($key, $op, $val) = (uc($1), $2, $3); $val = '' unless defined($val); die("$fn: unknown keyword on line $n\n") @@ -154,10 +154,22 @@ sub readconf($) { foreach (@a) { s/^\'([^\']*)\'$/$1/; } - $CONFIG{$key} = \@a; + if ($op eq '=') { + $CONFIG{$key} = \@a; + } elsif ($op eq '+=') { + push(@{$CONFIG{$key}}, @a); + } else { + die("can't happen\n"); + } } else { $val =~ s/^\'([^\']*)\'$/$1/; - $CONFIG{$key} = $val; + if ($op eq '=') { + $CONFIG{$key} = $val; + } elsif ($op eq '+=') { + die("$fn: invalid operator on line $n\n"); + } else { + die("can't happen\n"); + } } $line = ""; } |