summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLWinGoo.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-03-10 10:55:25 +0000
committerNorbert Preining <preining@logic.at>2009-03-10 10:55:25 +0000
commit7fc33b72fe3b9065b869fc12d83c1be6409f9f1a (patch)
tree8462d82ab6feabf6316d03a9f732db1d3eed7ed3 /Master/tlpkg/TeXLive/TLWinGoo.pm
parentef7cbcae137dbb3a922a9d0323129d83c752c084 (diff)
fix infinite loop in variable expansion (email Jjgod Jiang 10 Mar 2009)
in TLWinGoo.pm git-svn-id: svn://tug.org/texlive/trunk@12356 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLWinGoo.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm20
1 files changed, 11 insertions, 9 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index edffe918757..b1cfe76d1ea 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -286,17 +286,19 @@ values as environment variable and returns the result.
=cut
+sub expand_env {
+ my $key = shift;
+ foreach my $k (keys %ENV) {
+ return $ENV{$k} if (uc($k) eq uc($key));
+ }
+
+ return "%$key%";
+}
+
sub expand_string {
$s = shift @_;
- while ($s =~ /^([^%]*)%([^%]+)%(.*)$/) {
- foreach $k (keys %ENV) {
- if (uc($k) eq uc($2)) {
- $s = $1 . $ENV{$k} . $3;
- last;
- }
- }
- }
- $s;
+ $s =~ s/%([^%;]+)%/expand_env($1)/eg;
+ return $s;
}
=pod