Mailfromd |
|
General-Purpose Mail Filter |
Sergey Poznyakoff |
Mailfromd Manual (split by node): | ? |
Several constants are built into the MFL compiler. To discern them from user-defined ones, their names start and end with two underscores (‘__’).
The following constants are defined in mailfromd
version
6.0:
Expands to the name of the current source file.
Expands to the name of the current lexical context, i.e. the function or handler name.
Expands to the current line number in the input source file.
Expands to the major version number.
The following example uses __major__
constant to determine
if some version-dependent feature can be used:
if __major__ > 2
# Use some version-specific feature
fi
|
Expands to the minor version number.
Expands to the name of the current module (see section Modules).
Expands to the package name (‘mailfromd’)
For alpha versions and maintenance releases expands to the version patch level. For stable versions, expands to ‘0’.
Expands to the default external preprocessor command line, if the preprocessor is used, or to an empty string if it is not, e.g.:
__defpreproc__ ⇒ "/usr/bin/m4 -s" |
See section MFL Preprocessor, for information on preprocessor and its features.
Expands to the current external preprocessor command line, if the
preprocessor is used, or to an empty string if it is not. Notice,
that it equals __defpreproc__
, unless the preprocessor was
redefined using ‘--preprocessor’ command line option
(see section –preprocessor).
Expands to the textual representation of the program version (e.g. ‘3.0.90’)
Expands to the default state directory (see statedir).
Expands to the current value of the program state directory
(see statedir). Notice, that it is the same as
__defstatedir__
unless the state directory was redefined at run
time.
Built-in constants can be used as variables, this allows to expand them within strings or here-documents. The following example illustrates the common practice used for debugging configuration scripts:
func foo(number x) do echo "%__file__:%__line__: foo called with arg %x" … done |
If the function foo
were called in line 28 of the
script file /etc/mailfromd.mf
, like this:
foo(10)
, you will see the following string in your logs:
/etc/mailfromd.mf:28: foo called with arg 10 |
Mailfromd Manual (split by node): | ? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.