1cf118a656f5fd210787908b845362077fc507f8Evan Hunt#!/usr/bin/perl
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt#
93ca8abdf86dfe69d40c0bc5389151e0672780afTinderbox User# Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt#
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt# This Source Code Form is subject to the terms of the Mozilla Public
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt# License, v. 2.0. If a copy of the MPL was not distributed with this
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt# file, You can obtain one at http://mozilla.org/MPL/2.0/.
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntuse warnings;
1cf118a656f5fd210787908b845362077fc507f8Evan Huntuse strict;
1cf118a656f5fd210787908b845362077fc507f8Evan Huntuse Time::Piece;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntif (@ARGV < 1) {
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt print STDERR <<'END';
1cf118a656f5fd210787908b845362077fc507f8Evan Huntusage:
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt perl docbook-zoneopt.pl zoneopt_file [YYYY]
1cf118a656f5fd210787908b845362077fc507f8Evan HuntEND
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt exit 1;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt}
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntmy $FILE = shift;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntmy $t = Time::Piece->new();
1cf118a656f5fd210787908b845362077fc507f8Evan Huntmy $year;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt$year = `git log --max-count=1 --date=format:%Y --format='%cd' -- $FILE` or $year = $t->year;
1cf118a656f5fd210787908b845362077fc507f8Evan Huntchomp $year;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntopen (FH, "<", $FILE) or die "Can't open $FILE";
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntprint <<END;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt<!--
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt - Copyright (C) 2004-$year Internet Systems Consortium, Inc. ("ISC")
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt -
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt - This Source Code Form is subject to the terms of the Mozilla Public
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt - License, v. 2.0. If a copy of the MPL was not distributed with this
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt - file, You can obtain one at http://mozilla.org/MPL/2.0/.
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt-->
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt<!-- Generated by doc/misc/docbook-zoneopt.pl -->
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt<programlisting>
1cf118a656f5fd210787908b845362077fc507f8Evan HuntEND
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntwhile (<FH>) {
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt if (m{// not.*implemented} || m{// obsolete} || m{// test.*only}) {
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt next;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt }
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{ // not configured}{};
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{ // may occur multiple times}{};
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{<([a-z0-9_-]+)>}{<replaceable>$1</replaceable>}g;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{^(\s*)([a-z0-9_-]+)\b}{$1<command>$2</command>};
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{[[]}{[}g;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{[]]}{]}g;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt s{ }{\t}g;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt print;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt}
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt
1cf118a656f5fd210787908b845362077fc507f8Evan Huntprint <<END;
1cf118a656f5fd210787908b845362077fc507f8Evan Hunt</programlisting>
1cf118a656f5fd210787908b845362077fc507f8Evan HuntEND