aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-03-28 12:36:12 +0100
committerGravatar Christian Hesse <mail@eworm.de>2019-03-28 12:36:12 +0100
commit26ccf4129831b9a48c7c918e6614ec2fe5fad07f (patch)
tree79f8c104cbe8e38b73bde75d01d13a30132d6ea7 /global-functions
parent04b7b1f3b58eab5c8689b3ab8ba23d9f9bfb7838 (diff)
global-functions: prevent infinite loop
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions6
1 files changed, 4 insertions, 2 deletions
diff --git a/global-functions b/global-functions
index 043da42..1145200 100644
--- a/global-functions
+++ b/global-functions
@@ -44,6 +44,7 @@
:local ReplaceFrom [ :tostr $2 ];
:local ReplaceWith [ :tostr $3 ];
:local Len [ :len $ReplaceFrom ];
+ :local Return "";
:if ($ReplaceFrom = "") do={
:return $String;
@@ -51,10 +52,11 @@
:while ($String ~ $ReplaceFrom) do={
:local Pos [ :find $String $ReplaceFrom ];
- :set String ([ :pick $String 0 $Pos ] . $ReplaceWith . [ :pick $String ($Pos + $Len) 999 ]);
+ :set Return ($Return . [ :pick $String 0 $Pos ] . $ReplaceWith);
+ :set String [ :pick $String ($Pos + $Len) 999 ];
}
- :return $String;
+ :return ($Return . $String);
}
# check and import required certificates