From: Rudolf Polzer Date: Fri, 14 Sep 2012 11:05:11 +0000 (+0200) Subject: weird cfg file ;) X-Git-Tag: xonotic-v0.7.0~228 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d0f59e8e49c061631489e364b4e1b08096ac0280;p=xonotic%2Fxonotic-data.pk3dir.git weird cfg file ;) --- diff --git a/ifthenelse.cfg b/ifthenelse.cfg new file mode 100644 index 000000000..8bdd2ae0e --- /dev/null +++ b/ifthenelse.cfg @@ -0,0 +1,33 @@ +alias _dont "" +alias _do "$*" + +set _ifstack "" +alias : "$_ifstack $*" + +alias :ifeq "set _ifnew_$1 _dont; set _ifnew_$2 _do; _ifeq_2 _ifnew_$1" +alias :ifneq "set _ifnew_$1 _do; set _ifnew_$2 _dont; _ifeq_2 _ifnew_$1" +alias _ifeq_2 "set _ifstack \"${$1} $_ifstack\"" +alias :else "_else_2$_ifstack" +alias _else_2_do "set _ifstack \"_dont ${* q?}\"" +alias _else_2_dont "set _ifstack \"_do ${* q?}\"" +alias :endif "_endif_2 $_ifstack" +alias _endif_2 "set _ifstack \"${2- q?}\"" + +// EXAMPLE: +// :ifeq "$a" "$b" +// :ifeq "$a" "$c" +// : echo "a == b == c" +// :else +// : echo "a == b != c" +// :endif +// :else +// :ifeq "$a" "$c" +// : echo "a == c != b" +// :else +// :ifeq "$b" "$c" +// : echo "b == c != a" +// :else +// : echo "a != b != c != a" +// :endif +// :endif +// :endif