update_copyrights revision 144a3203a6e1827d78fb046e92b15ece82e6e378
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater# Copyright (C) 1998-2001 Internet Software Consortium.
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrence# Permission to use, copy, modify, and/or distribute this software for any
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# purpose with or without fee is hereby granted, provided that the above
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# 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
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrence# PERFORMANCE OF THIS SOFTWARE.
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrence# $Id: update_copyrights,v 1.50 2007/08/28 02:12:55 marka Exp $
7c74e180c206e6ed99e8beb820da5f399d845c3eDavid Lawrencerequire 5.002;
ea31416b4fcdf23732355a8002f93f29e3b3d2dbAndreas Gustafsson# Map copyright owners to the files containing copyright messages.
866d106459313499d0ca7bfccb4b2d23d5e4377cDavid Lawrence# The first line of the copyright message is not in the file;
03e200df5dc283f24a6a349f0b31d3eab26da893Mark Andrews# it is constructed by this script.
3d776d762914d1b675b4fd49728ce353ccf6f77eBrian Wellington# Map each copyright owner name to a reference to an array containing
ccdac53c027e8964753b36c4d8c7b0e98af501c2Michael Graff# the lines of the copyright message.
03e200df5dc283f24a6a349f0b31d3eab26da893Mark Andrewsmy $keyword_pat = '\$(Id:.*|Revision:.*|Id|Revision)\$';
75a4dd0d377dca2f85cea44e28bf110314c1fe8cDavid Lawrence open(COPYRIGHT, "<$f") || die "can't open $f: $!";
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley if (defined($years_list) && $years_list =~ /^PARENT:/) {
3b77946b751f39bd4db5a7d1fe48a81e6b1e7a28Bob Halley $parent =~ s/\.[^.]*$/.docbook/;
8e06cea14c857429ab7e7299af2dce5eeeaa5ff0Michael Graff $result = "$result <year>$_</year>\n" foreach (@_);
3ecf3394e37dc2848a09ffc643565d454e9e6974Andreas Gustafsson $result = "$result <holder>$holder</holder>\n";
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence my $a = copyright("Internet Systems Consortium, Inc. (\"ISC\")",
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence my $b = copyright("Internet Software Consortium.",
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews # copyright notice is now generated from the source.
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence my ($type, $owner) = split(/\./, $typeandowner);
0293ad13207aa29bd5844cdc87d085ffc009d749David Lawrence print "$file: unknown copyright owner $owner\n";
df3c4c7988b9bae7d121a8ac9ed17a23366a948dDavid Lawrence } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH|RNC)$/) {
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence print "$file: type '$type' not supported yet; skipping\n";
4bcaefbcd3ced942139fdc830e007c6ea2b8d2feDavid Lawrence open(SOURCE, "<$file") || die "can't open $file: $!";
641da3ca1184d9951d5cf91538524a345bf5f271Mark Andrews last if $_ =~ /\*\//;
774c3a62d9adca187b44fe90919bb409a43a2f2aMark Andrews } elsif (($m4_comment || $zone_comment || $man_comment) &&
6fcb2f0faad67a6d2cb2e30ec57157d75fbfe58fAndreas Gustafsson while (/^<!DOCTYPE/ || /^<\?xml-stylesheet/ || /^<\?xml /) {
6fcb2f0faad67a6d2cb2e30ec57157d75fbfe58fAndreas Gustafsson $before_copyright = "$before_copyright$_";
43fe2897fc80bbec2115310ca79d432a252f3ea4Mark Andrews last if s/.*-->//;
754cca729dd82ae8363917dc00ad44f9d900635bMark Andrews # Not very maintainable, but ok enough for now.
40dd9cb8cc240c33d820fe79f176ed51e4c06a1aMark Andrews open(TARGET, ">$file.new") || die "can't open $file.new: $!";
40dd9cb8cc240c33d820fe79f176ed51e4c06a1aMark Andrews print TARGET $before_copyright if $before_copyright;
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 if ($last_year != 0 && $year == $last_year + 1) {
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 $years .= $last_year == 0 ? "$year" : ", $year";
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 if ($last_year != 0 && $year == $last_year + 1) {
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson $years .= $last_year == 0 ? "$year" : ", $year";
a1898260ad19d02e88ab76c1855d33c67add9defMark Andrews if ($last_year != 0 && $year == $last_year + 1) {
5ff133b82082d82f0ba89b7c999c6b62b6298e46Andreas Gustafsson $years .= $last_year == 0 ? "$year" : ", $year";
13faa8b6a2d0d45e0659049983928366252ab3faMichael Graff ($firstline, $secondline, @otherlines) = @$textp;
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
a53259c4cc558f86dd008eccc60cc89b6734a03cMark Andrews s:modify, and distribute:modify, and/or distribute: if ($andor);
a53259c4cc558f86dd008eccc60cc89b6734a03cMark Andrews print TARGET (/^$/ ? $nonspaceprefix : $prefix);
a53259c4cc558f86dd008eccc60cc89b6734a03cMark Andrews if ($type eq 'SGML' && m:<articleinfo>.*?</articleinfo>:s) {
68f72235f8f41fa949823551d8e6476057ec5bd6Andreas Gustafsson s:<articleinfo>.*?</articleinfo>:<articleinfo>\n$r </articleinfo>:s;
68f72235f8f41fa949823551d8e6476057ec5bd6Andreas Gustafsson if ($type eq 'SGML' && m:<docinfo>.*?</docinfo>:s) {
68f72235f8f41fa949823551d8e6476057ec5bd6Andreas Gustafsson s:<docinfo>.*?</docinfo>:<docinfo>\n$r </docinfo>:s;
68f72235f8f41fa949823551d8e6476057ec5bd6Andreas Gustafsson if ($type eq 'SGML' && m:<bookinfo>.*?</bookinfo>:s) {
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews s:<bookinfo>.*?</bookinfo>:<bookinfo>\n$r </bookinfo>:s;
c5826852e6c789f59b301f8197e65a1dd4e09a44Mark Andrews if ($first !~ /$keyword_pat/ && $_ !~ /$keyword_pat/) {
f8f65e2de40b1e9874b88f392f3abeb057ce6172Mark Andrews $end = "\n$nonspaceprefix" if ($type eq "MAN");
c16aed9c469a986f1b84e457db4a8c4d2da01ca3Mark Andrews print TARGET $first if $first !~ /^\s*$/;