Scripts and programs that need to operate on a variety of data or with different parameters should retrieve all variable information via metadb.
The special key
INCLUDE
is used to perform file inclusions:
INCLUDE /some/other/config/file
allowing config files to ``inherit'' from other config files.
Note that key-value pairs preceding an inclusion override any identical
key in the included file.
The
ALIAS
keyword redirects a lookup for one key
key1
by another lookup for
key2:
ALIAS key1 key2
The
ALIAS_SUFFIX
keyword redirects a lookup for any key
with suffix
suffix1
to another lookup with the suffix replaced by
suffix2:
ALIAS_SUFFIX suffix1 suffix2
This is a convenient way to apply a string mapping to an entire
family of keys.
To avoid infinite recursions and ambiguities in matching keys,
the prefix of the key that is matched by
suffix1
must no contain any underscore characters.
Lines containing only whitespace or starting with a pound sign are ignored:
# this is a comment
There is also a primitive macro facility:
DEFINE string string2
causes
string
to be replaced by
string2
in the output.
SDEFINE string comand arg1 arg2 ...
defines
string
as a macro expanding to the first line of output of
command.
This also allows ``importing'' environment variables:
SDEFINE MACHINE_TYPE printenv MACHINE_TYPE
(but note the expansion of macros inside the config file does not use
dollar signs).
The directive
MDEFINE string key
defines
string
as a macro expanding to the result of looking up
key
using
metadb
itself in the current configuration file.
This allows piecing together of strings from various key values,
and other back-handed uses.
UNDEF string
undoes the definition of
string.
Macros are expanded in key values, include filenames, and the definitions of other macros (at the time of definition).