mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-13 11:34:31 +02:00
global-functions: prevent infinite loop
This commit is contained in:
parent
04b7b1f3b5
commit
26ccf41298
1 changed files with 4 additions and 2 deletions
|
@ -44,6 +44,7 @@
|
||||||
:local ReplaceFrom [ :tostr $2 ];
|
:local ReplaceFrom [ :tostr $2 ];
|
||||||
:local ReplaceWith [ :tostr $3 ];
|
:local ReplaceWith [ :tostr $3 ];
|
||||||
:local Len [ :len $ReplaceFrom ];
|
:local Len [ :len $ReplaceFrom ];
|
||||||
|
:local Return "";
|
||||||
|
|
||||||
:if ($ReplaceFrom = "") do={
|
:if ($ReplaceFrom = "") do={
|
||||||
:return $String;
|
:return $String;
|
||||||
|
@ -51,10 +52,11 @@
|
||||||
|
|
||||||
:while ($String ~ $ReplaceFrom) do={
|
:while ($String ~ $ReplaceFrom) do={
|
||||||
:local Pos [ :find $String $ReplaceFrom ];
|
: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
|
# check and import required certificates
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue