aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions9
1 files changed, 9 insertions, 0 deletions
diff --git a/global-functions b/global-functions
index fe51031..e20017b 100644
--- a/global-functions
+++ b/global-functions
@@ -27,6 +27,7 @@
:global GetMacVendor;
:global GetRandomNumber;
:global GetRandomSha256;
+:global IfThenElse;
:global IPCalc;
:global LogPrintExit;
:global MailServerIsUp;
@@ -339,6 +340,14 @@
:return $FingerPrint;
}
+# mimic conditional/ternary operator (condition ? consequent : alternative)
+:set IfThenElse do={
+ :if ([ :tostr $1 ] = "true" || [ :tobool $1 ] = true) do={
+ :return $2;
+ }
+ :return $3;
+}
+
# calculate and print netmask, network, min host, max host and broadcast
:set IPCalc do={
:local Input [ :tostr $1 ];