update_copyrights revision c968a9ca37964ae0bdc5d452ad784ec93bd04c57
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# Copyright (C) 1998-2001 Internet Software Consortium.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# Permission to use, copy, modify, and distribute this software for any
fb84f9014321c5f33c4682de5661b579fcde318fAndreas Gustafsson# purpose with or without fee is hereby granted, provided that the above
fb84f9014321c5f33c4682de5661b579fcde318fAndreas Gustafsson# copyright notice and this permission notice appear in all copies.
9016767f4e15191b7c763b8a4ad36a57dc2705a2Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
9016767f4e15191b7c763b8a4ad36a57dc2705a2Mark Andrews# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
9016767f4e15191b7c763b8a4ad36a57dc2705a2Mark Andrews# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
9016767f4e15191b7c763b8a4ad36a57dc2705a2Mark Andrews# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
9016767f4e15191b7c763b8a4ad36a57dc2705a2Mark Andrews# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
9016767f4e15191b7c763b8a4ad36a57dc2705a2Mark Andrews# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
fb84f9014321c5f33c4682de5661b579fcde318fAndreas Gustafsson# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# $Id: update_copyrights,v 1.25 2001/06/10 14:01:10 tale Exp $
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinrequire 5.002;
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Map copyright owners to the files containing copyright messages.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# The first line of the copyright message is not in the file;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# it is constructed by this script.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User# Map each copyright owner name to a reference to an array containing
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the lines of the copyright message.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein open(COPYRIGHT, "<$f") || die "can't open $f: $!";
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein ($file, $typeandowner, $years_list) = split(/\s+/);
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User my ($type, $owner) = split(/\./, $typeandowner);
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User print "$file: unknown copyright owner $owner\n";
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User } elsif ($type =~ /^(SH|PERL|TCL|MAKE|CONF-SH)$/) {
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User } elsif ($type eq "HTML" || $type eq "SGML") {
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox User print "$file: type '$type' not supported yet; skipping\n";
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User open(SOURCE, "<$file") || die "can't open $file: $!";
260e8e04b0dc24cb884c789b5d9eb046457f264eTinderbox User last if $_ =~ /\*\//;
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User } elsif (($m4_comment || $zone_comment || $man_comment) &&
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User last if s/.*-->//;
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User # Not very maintainable, but ok enough for now.
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User open(TARGET, ">$file.new") || die "can't open $file.new: $!";
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User print TARGET $before_copyright if $before_copyright;
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User print TARGET $start_comment if $start_comment;
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User if ($last_year != 0 && $year == $last_year + 1) {
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User $years .= $last_year == 0 ? "$year" : ", $year";
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User ($firstline, $secondline, @otherlines) = @$textp;
3241ddcf9354c5ab50f4df5a656e72a5c68e172bTinderbox User print TARGET $secondline =~ /^$/ ? $nonspaceprefix : $prefix;
fd2597f75693a2279fdf588bd40dfe2407c42028Tinderbox User print TARGET (/^$/ ? $nonspaceprefix : $prefix);
print TARGET $end_comment if $end_comment;
undef $/;
$_ = <SOURCE>;
print TARGET $_;