diff --git a/tools/genlang b/tools/genlang index 19b637d237..33adb2c7e3 100755 --- a/tools/genlang +++ b/tools/genlang @@ -121,7 +121,23 @@ if(!$target && !$update && !$sortfile) { print STDERR "Please specify a target (with -t)!\n"; exit; } -my @target_parts = split ':', $target; + +# Build up a regex which can be applied to target wildcard lists. We only need +# to support prefix matches, so a target parameter of foo:bar can be expanded +# to the regex "\*|f\*|fo\*|foo|b\*|ba\*|bar" and applied to the wildcard list +# (plus end-of-string or commas on either side). The regex engine should +# discard any duplicates generated for us in the process of constructing the +# state machine, so we don't bother to check. +my $target_regex = "(?:^|,) *(?:\\*"; +foreach my $target_part (split ':', $target) { + for (my $c=1; $c $v\n"; - $$strref = $string; - return $string; - } - } + if ($n =~ $target_regex) { + $string = $v; + $$strref = $string; + return $string; } }