#!/usr/bin/perl # # Copyright (C) Internet Systems Consortium, Inc. ("ISC") # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. use warnings; use strict; use Time::Piece; if (@ARGV < 1) { print STDERR <<'END'; usage: perl docbook-options.pl options_file [YYYY/MM/DD] >named.conf.docbook END exit 1; } my $FILE = shift; my $DATE; if (@ARGV >= 2) { $DATE = shift } else { $DATE = `git log --max-count=1 --date=short --format='%cd' $FILE` or die "unable to determine last modification date of '$FILE'; specify on command line\nexiting"; } chomp $DATE; open (FH, "<", $FILE) or die "Can't open $FILE"; my $t = Time::Piece->new(); my $year = $t->year; print < $DATE ISC Internet Systems Consortium, Inc. named.conf 5 BIND9 named.conf configuration file for named END for (my $y = 2004; $y <= $year; $y++) { print " $y\n"; } print <Internet Systems Consortium, Inc. ("ISC") named.conf DESCRIPTION named.conf is the configuration file for named. Statements are enclosed in braces and terminated with a semi-colon. Clauses in the statements are also semi-colon terminated. The usual comment styles are supported: C style: /* */ C++ style: // to end of line Unix style: # to end of line END # skip preamble my $preamble = 0; while () { if (m{^\s*$}) { last if $preamble > 0; } else { $preamble++; } } my $blank = 0; while () { if (m{// not.*implemented} || m{// obsolete} || m{// test.*only}) { next; } s{ // not configured}{}; s{ // non-operational}{}; s{ // may occur multiple times}{}; s{<([a-z0-9_-]+)>}{$1}g; s{[[]}{[}g; s{[]]}{]}g; s{ }{\t}g; if (m{^([a-z0-9-]+) }) { my $HEADING = uc $1; print <$HEADING END } if (m{^\s*$} && !$blank) { $blank = 1; print < END } else { $blank = 0; } print; } print <FILES /etc/named.conf SEE ALSO ddns-confgen8 , named8 , named-checkconf8 , rndc8 , rndc-confgen8 , BIND 9 Administrator Reference Manual. END