| 1 | m4_divert(-1) ### -*-m4-*- |
| 2 | ### |
| 3 | ### Definitions for generating zone files. |
| 4 | |
| 5 | m4_changequote([, ]) |
| 6 | |
| 7 | ###-------------------------------------------------------------------------- |
| 8 | ### Utilities. |
| 9 | |
| 10 | ## FOREACH(what, list) |
| 11 | ## |
| 12 | ## The LIST is a comma-separated list of things, like an m4 argument list. |
| 13 | ## For each item in the list, expand WHAT as if it's the body of a macro with |
| 14 | ## the list item as its arguments. In other words, the list item itself can |
| 15 | ## be a list of comma-separated items, which are available as $1, $2, ..., |
| 16 | ## within WHAT. |
| 17 | m4_define([_FOREACH], [m4_dnl |
| 18 | m4_ifelse([$#], [1], [_foreach_func($1)], |
| 19 | [_foreach_func($1)[]_FOREACH(m4_shift($@))])]) |
| 20 | m4_define([FOREACH], [m4_dnl |
| 21 | m4_pushdef([_foreach_func], [$1])m4_dnl |
| 22 | _FOREACH($2)[]m4_dnl |
| 23 | m4_popdef([_foreach_func])]) |
| 24 | |
| 25 | ## SUBZONE(name) |
| 26 | ## |
| 27 | ## Delegate NAME to the NAMESERVERS. |
| 28 | m4_define([SUBZONE], [m4_dnl |
| 29 | FOREACH([m4_dnl |
| 30 | m4_ifelse($1,@,$][1,$][1.$1) IN A $][2 |
| 31 | ], [NAMESERVERS]) |
| 32 | FOREACH([m4_dnl |
| 33 | $1 IN NS m4_ifelse($1,@,$][1,$][1.$1) |
| 34 | ], [NAMESERVERS])]) |
| 35 | |
| 36 | ###-------------------------------------------------------------------------- |
| 37 | ### Configuration. |
| 38 | |
| 39 | m4_define([CONTACT], [hostmaster.BASE]) |
| 40 | m4_define([BLACKHOLE], [[A, 212.13.198.78], [AAAA, 2001:ba8:0:1d9::ffff]]) |
| 41 | m4_include([config.m4]) |
| 42 | |
| 43 | ###----- That's all, folks -------------------------------------------------- |
| 44 | m4_divert(0)m4_dnl |