update_copyrights revision 10e873cb368b0ed17a328e5421a0411eb90da0cb
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
499b34cea04a46823d003d4c0520c8b03e8513cbBrian Wellington# Copyright (C) 1998-2001 Internet Software Consortium.
5fbced719b71e659322b4ce3e4a39c9b039674c7Bob Halley# Permission to use, copy, modify, and distribute this software for any
5fbced719b71e659322b4ce3e4a39c9b039674c7Bob Halley# purpose with or without fee is hereby granted, provided that the above
5fbced719b71e659322b4ce3e4a39c9b039674c7Bob Halley# copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
10e873cb368b0ed17a328e5421a0411eb90da0cbMark Andrews# $Id: update_copyrights,v 1.42 2006/10/24 00:57:16 marka Exp $
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: $!";
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";
abfb7fe67fd97adfa4628afa79af5d98c2d9cad0Andreas Gustafsson } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH)$/) {
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 $_ =~ /\*\//;
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence } elsif (($m4_comment || $zone_comment || $man_comment) &&
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";
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence if ($last_year != 0 && $year == $last_year + 1) {
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence $years .= $last_year == 0 ? "$year" : ", $year";
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews ($firstline, $secondline, $thirdline, @otherlines) = @$textp;
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
0295f63b67bb09cd4d00dd1d9c2238c37beefed8Mark Andrews print TARGET $thirdline =~ /^$/ ? $nonspaceprefix : $prefix;
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print TARGET (/^$/ ? $nonspaceprefix : $prefix);
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/;
c968a9ca37964ae0bdc5d452ad784ec93bd04c57David Lawrence if ($first !~ /$keyword_pat/ && $_ !~ /$keyword_pat/) {
6ca4964362ec37d6afbf614dbb9aaa2f525002f1Mark Andrews $end = "\n$nonspaceprefix" if ($type eq "MAN");
f4a7d04843eb62c92f2d4ff338da49ae86e3279bDavid Lawrence print TARGET $first if $first !~ /^\s*$/;