update_copyrights revision c61c6db1cea02006815184845fcf1b633b28163d
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC")
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Copyright (C) 1998-2001 Internet Software Consortium.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Permission to use, copy, modify, and distribute this software for any
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# purpose with or without fee is hereby granted, provided that the above
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# copyright notice and this permission notice appear in all copies.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# PERFORMANCE OF THIS SOFTWARE.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# $Id: update_copyrights,v 1.37 2005/05/12 08:08:44 marka Exp $
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsrequire 5.002;
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrews# Map copyright owners to the files containing copyright messages.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# The first line of the copyright message is not in the file;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# it is constructed by this script.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Map each copyright owner name to a reference to an array containing
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# the lines of the copyright message.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsmy $keyword_pat = '\$(Id:.*|Revision:.*|Id|Revision)\$';
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews open(COPYRIGHT, "<$f") || die "can't open $f: $!";
b2f07642fd712c8fda81a116bcdde229ab291f33Tinderbox User if (defined($years_list) && $years_list =~ /^PARENT:/) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $parent =~ s/\.[^.]*$/.docbook/;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews $result = "$result <year>$_</year>\n" foreach (@_);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User $result = "$result <holder>$holder</holder>\n";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews my $a = copyright("Internet Systems Consortium, Inc. (\"ISC\")",
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews my $b = copyright("Internet Software Consortium.",
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews my ($type, $owner) = split(/\./, $typeandowner);
c247e3f281613fabe1af362e9f3157e35ebbe52cMark Andrews print "$file: unknown copyright owner $owner\n";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH)$/) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User } elsif ($type eq "HTML" || $type eq "SGML") {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print "$file: type '$type' not supported yet; skipping\n";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User open(SOURCE, "<$file") || die "can't open $file: $!";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User last if $_ =~ /\*\//;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User } elsif (($m4_comment || $zone_comment || $man_comment) &&
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User last if s/.*-->//;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User # Not very maintainable, but ok enough for now.
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User open(TARGET, ">$file.new") || die "can't open $file.new: $!";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print TARGET $before_copyright if $before_copyright;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print TARGET $start_comment if $start_comment;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if ($last_year != 0 && $year == $last_year + 1) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User $years .= $last_year == 0 ? "$year" : ", $year";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if ($last_year != 0 && $year == $last_year + 1) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User $years .= $last_year == 0 ? "$year" : ", $year";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if ($last_year != 0 && $year == $last_year + 1) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User $years .= $last_year == 0 ? "$year" : ", $year";
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User ($firstline, $secondline, $thirdline, @otherlines) = @$textp;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print TARGET $thirdline =~ /^$/ ? $nonspaceprefix : $prefix;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print TARGET (/^$/ ? $nonspaceprefix : $prefix);
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if ($type eq 'SGML' && m:<docinfo>.*?</docinfo>:s) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User s:<docinfo>.*?</docinfo>:<docinfo>\n$r </docinfo>:s;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if ($type eq 'SGML' && m:<bookinfo>.*?</bookinfo>:s) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User s:<bookinfo>.*?</bookinfo>:<bookinfo>\n$r </bookinfo>:s;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User ($end = $end_comment) =~ s/^\s*(.*)\n/ $1\n/;
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User if ($first !~ /$keyword_pat/ && $_ !~ /$keyword_pat/) {
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User $end = "\n$nonspaceprefix" if ($type eq "MAN");
0ccb0e98c77a9b9636a036f8f64f5679a430aaf4Tinderbox User print TARGET $first if $first !~ /^\s*$/;