update_copyrights revision 247bf378605811d695e968dbe930a7fc45c0038e
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * Copyright (C) 2004-2010, 2012 Internet Systems Consortium, Inc. ("ISC")
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * Copyright (C) 1998-2001 Internet Software Consortium.
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * Permission to use, copy, modify, and/or distribute this software for any
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * purpose with or without fee is hereby granted, provided that the above
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * copyright notice and this permission notice appear in all copies.
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
247bf378605811d695e968dbe930a7fc45c0038eTinderbox User * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5a6e6c2c9b2f6cf426aa2a682aa800765e26d540Andreas Gustafsson# Map copyright owners to the files containing copyright messages.
5a6e6c2c9b2f6cf426aa2a682aa800765e26d540Andreas Gustafsson# The first line of the copyright message is not in the file;
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence# it is constructed by this script.
5a6e6c2c9b2f6cf426aa2a682aa800765e26d540Andreas Gustafsson# Map each copyright owner name to a reference to an array containing
5a6e6c2c9b2f6cf426aa2a682aa800765e26d540Andreas Gustafsson# the lines of the copyright message.
6ca4964362ec37d6afbf614dbb9aaa2f525002f1Mark Andrewsmy $keyword_pat = '\$(Id:.*|Revision:.*|Id|Revision)\$';
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence open(COPYRIGHT, "<$f") || die "can't open $f: $!";
9640c35421ba0bb4af6b6bfbff695d2a0ac560b3Mark Andrews($dummy,$dummy,$dummy,$dummy,$this_month,$this_year,$dummy,$dummy,$dummy) = localtime(time());
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews if (defined($years_list) && $years_list =~ /^PARENT:/) {
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews $parent =~ s/\.[^.]*$/.docbook/;
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews $result = "$result <year>$_</year>\n" foreach (@_);
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews $result = "$result <holder>$holder</holder>\n";
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews my $a = copyright("Internet Systems Consortium, Inc. (\"ISC\")",
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews my $b = copyright("Internet Software Consortium.",
f6161d8b90541b52946ae845bc8e2bec2647d6cbMark Andrews # copyright notice is now generated from the source.
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence my ($type, $owner) = split(/\./, $typeandowner);
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print "$file: unknown copyright owner $owner\n";
2da2220fe7af2c45724b50b0187523b1fab0cf08Rob Austein } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH|RNC)$/) {
9640c35421ba0bb4af6b6bfbff695d2a0ac560b3Mark Andrews $start_comment = "############################################################################\n";
9640c35421ba0bb4af6b6bfbff695d2a0ac560b3Mark Andrews $end_comment = "############################################################################\n"
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print "$file: type '$type' not supported yet; skipping\n";
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence open(SOURCE, "<$file") || die "can't open $file: $!";
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence last if $_ =~ /\*\//;
9640c35421ba0bb4af6b6bfbff695d2a0ac560b3Mark Andrews $_ = <SOURCE> if $_ eq "############################################################################\n";
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence } elsif (($m4_comment || $zone_comment || $man_comment) &&
3d17258ff6c22bee15e3197d0e61a7ecaba7ed86Mark Andrews while (/^<!DOCTYPE/ || /^<\?xml-stylesheet/ || /^<\?xml /) {
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence last if s/.*-->//;
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence # Not very maintainable, but ok enough for now.
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence open(TARGET, ">$file.new") || die "can't open $file.new: $!";
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print TARGET $before_copyright if $before_copyright;
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print TARGET $start_comment if $start_comment;
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews if ($last_year != 0 && $year == $last_year + 1) {
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews $years .= $last_year == 0 ? "$year" : ", $year";
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews if ($last_year != 0 && $year == $last_year + 1) {
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews $years .= $last_year == 0 ? "$year" : ", $year";
9640c35421ba0bb4af6b6bfbff695d2a0ac560b3Mark Andrews $noid = 1 if ($year > 2012 || ($year == 2012 && $this_month >= 5) );
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence if ($last_year != 0 && $year == $last_year + 1) {
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence $years .= $last_year == 0 ? "$year" : ", $year";
599a98b25ca10c501bdf3368eab2a2a951130949Mark Andrews ($firstline, $secondline, @otherlines) = @$textp;
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
144a3203a6e1827d78fb046e92b15ece82e6e378Mark Andrews s:modify, and distribute:modify, and/or distribute: if ($andor);
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print TARGET (/^$/ ? $nonspaceprefix : $prefix);
7877ad5db24dbad945afc670b2010c70d0d7e2f5Mark Andrews if ($type eq "C" && $sysyears =~ /$this_year/) {
14731fe09a82ff330f999236ad40571de033d523Mark Andrews # Remove 1-7 spaces followed by a tab into a single
14731fe09a82ff330f999236ad40571de033d523Mark Andrews # tab if at start of line or proceeded by tabs.
14731fe09a82ff330f999236ad40571de033d523Mark Andrews # Convert 8 spaces into tabs if at start of line
14731fe09a82ff330f999236ad40571de033d523Mark Andrews s/[ \t]*$//;
10e873cb368b0ed17a328e5421a0411eb90da0cbMark Andrews if ($type eq 'SGML' && m:<articleinfo>.*?</articleinfo>:s) {
10e873cb368b0ed17a328e5421a0411eb90da0cbMark Andrews s:<articleinfo>.*?</articleinfo>:<articleinfo>\n$r </articleinfo>:s;
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews if ($type eq 'SGML' && m:<docinfo>.*?</docinfo>:s) {
c61c6db1cea02006815184845fcf1b633b28163dMark Andrews s:<docinfo>.*?</docinfo>:<docinfo>\n$r </docinfo>:s;
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews if ($type eq 'SGML' && m:<bookinfo>.*?</bookinfo>:s) {
e107074f370ee86275bd64ab8bcaa429fec1c7e2Mark Andrews s:<bookinfo>.*?</bookinfo>:<bookinfo>\n$r </bookinfo>:s;
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence ($end = $end_comment) =~ s/^\s*(.*)\n/ $1\n/;
6ca4964362ec37d6afbf614dbb9aaa2f525002f1Mark Andrews $end = "\n$nonspaceprefix" if ($type eq "MAN");
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print TARGET $first if $first !~ /^\s*$/;