Re-set-ing constants/variables
Ondrej Zajicek
santiago at crfreenet.org
Thu Jan 19 13:00:06 CET 2017
On Wed, Jan 18, 2017 at 06:20:53PM +0100, Maximilian Wilhelm wrote:
> Hi,
>
> Are there any means to build something like that? Like having some
> defaults in the main config and re-set these values later on (in other
> config snippets)? If I would generate the defines by a script I would
> have some time where this part might be missing (like on first install)
> and my config would fail to load as the defines are referenced but not
> defined.
Hi
Yes, defines are constants. There are some ugly tricks how to do that [*],
but i would strongly suggest just to ensure there is always a generated
script with defines.
Note that if the script referenced by include does not exist, config
also fails. That could be avoided by using wildcard in include.
[*] e.g. use function variables instead of constants:
function get_val()
int val;
{
val = 0;
include "val.conf*";
return val;
}
or use that include may appear inside of expressions:
define val = (1 ~ [
include "val.conf*";
0 ]);
(val is either false or true, depending of whether it expands to 1 ~ [0]
or 1 ~ [1, 0]; you would have to add comma to the value in included file)
--
Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170119/4b01152b/attachment.asc>
More information about the Bird-users
mailing list