mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-06-01 08:12:39 +00:00
dhcp-to-dns: make ToLower a local function, no global-functions dependency
This commit is contained in:
parent
6b2ec93ee6
commit
418ede0ae4
2 changed files with 16 additions and 20 deletions
|
|
@ -27,13 +27,28 @@
|
|||
:global LogPrintOnce;
|
||||
:global ParseKeyValueStore;
|
||||
:global ScriptLock;
|
||||
:global ToLower;
|
||||
|
||||
:if ([ $ScriptLock $ScriptName 10 ] = false) do={
|
||||
:set ExitOK true;
|
||||
:error false;
|
||||
}
|
||||
|
||||
:local ToLower do={
|
||||
:local Input [ :tostr $1 ];
|
||||
:local Upper "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
:local Lower "abcdefghijklmnopqrstuvwxyz";
|
||||
:local Return "";
|
||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||
:local Char [ :pick $Input $I ];
|
||||
:local Pos [ :find $Upper $Char ];
|
||||
:if ([ :typeof $Pos ] != "nil") do={
|
||||
:set Char [ :pick $Lower $Pos ($Pos + 1) ];
|
||||
}
|
||||
:set Return ($Return . $Char);
|
||||
}
|
||||
:return $Return;
|
||||
}
|
||||
|
||||
:local Ttl 5m;
|
||||
:local CommentPrefix ("managed by " . $ScriptName);
|
||||
:local CommentString ("--- " . $ScriptName . " above ---");
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@
|
|||
:global SendNotification2;
|
||||
:global SymbolByUnicodeName;
|
||||
:global SymbolForNotification;
|
||||
:global ToLower;
|
||||
:global Unix2Dos;
|
||||
:global UrlEncode;
|
||||
:global ValidateSyntax;
|
||||
|
|
@ -303,24 +302,6 @@
|
|||
:return $Path;
|
||||
}
|
||||
|
||||
# convert string to lower case
|
||||
:set ToLower do={
|
||||
:local Input [ :tostr $1 ];
|
||||
:local Upper "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
:local Lower "abcdefghijklmnopqrstuvwxyz";
|
||||
:local Return "";
|
||||
|
||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||
:local Char [ :pick $Input $I ];
|
||||
:local Pos [ :find $Upper $Char ];
|
||||
:if ([ :typeof $Pos ] != "nil") do={
|
||||
:set Char [ :pick $Lower $Pos ($Pos + 1) ];
|
||||
}
|
||||
:set Return ($Return . $Char);
|
||||
}
|
||||
:return $Return;
|
||||
}
|
||||
|
||||
# clean name for DNS, file and more
|
||||
:set CleanName do={
|
||||
:local Input [ :tostr $1 ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue