From 5a6e6c2c9b2f6cf426aa2a682aa800765e26d540 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Fri, 9 Jun 2000 19:32:32 +0000 Subject: [PATCH] support multiple copyright messages, in particular the joint NAI/ISC one; update_copyrights no longer takes the name of the copyright message file as a command line argument --- util/COPYRIGHT | 2 ++ util/COPYRIGHT.NAI | 2 +- util/update_copyrights | 63 +++++++++++++++++++++++++++++------------- 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/util/COPYRIGHT b/util/COPYRIGHT index e0eda1c0fa..3eab910f11 100644 --- a/util/COPYRIGHT +++ b/util/COPYRIGHT @@ -1,3 +1,5 @@ +Copyright (C) @YEARS@ Internet Software Consortium. + Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. diff --git a/util/COPYRIGHT.NAI b/util/COPYRIGHT.NAI index 0d80a25a05..8410edd078 100644 --- a/util/COPYRIGHT.NAI +++ b/util/COPYRIGHT.NAI @@ -1,4 +1,4 @@ -Portions Copyright (C) 1999, 2000 Internet Software Consortium. +Portions Copyright (C) @YEARS@ Internet Software Consortium. Portions Copyright (C) 1995-2000 by Network Associates, Inc. Permission to use, copy, modify, and distribute this software for any diff --git a/util/update_copyrights b/util/update_copyrights index b3dd6c0b09..52c61b5791 100644 --- a/util/update_copyrights +++ b/util/update_copyrights @@ -15,16 +15,32 @@ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS # SOFTWARE. -if (@ARGV == 0) { - die "usage: update_copyrights "; +require 5.002; + +# Map copyright owners to the files containing copyright messages. +# The first line of the copyright message is not in the file; +# it is constructed by this script. + +my %owner2filename = ( + "" => "util/COPYRIGHT", + "NAI" => "util/COPYRIGHT.NAI" +); + +# Map each copyright owner name to a reference to an array containing +# the lines of the copyright message. + +my %owner2text = (); + +foreach $owner (keys %owner2filename) { + my $f = $owner2filename{$owner}; + open(COPYRIGHT, "<$f") || die "can't open $f: $!"; + @copyright_text = ; + close(COPYRIGHT); + $owner2text{$owner} = [ @copyright_text ]; } -@copyright_text = (); -open(COPYRIGHT, "<$ARGV[0]") || die "can't open $ARGV[0]: $!"; -@copyright_text = <>; -close(COPYRIGHT); while (<>) { - ($file, $type, $years_list) = split(/\s+/); + ($file, $typeandowner, $years_list) = split(/\s+/); @years = split(/,/, $years_list); if ( ! -f $file ) { @@ -32,15 +48,18 @@ while (<>) { next; } - next if $type eq "X"; + my ($type, $owner) = split(/\./, $typeandowner); + $owner = "" if !defined $owner; - if ($type =~ /\.NAI$/) { - # XXX Not handled yet; co-copyrighted with Network Associates. - # lib/isc/commandline.c should probably also have special handling. - print "$file: co-copyrighted with Network Associates; ", - "update manually\n"; + $textp = $owner2text{$owner}; + if (!defined $textp) { + print "$file: unknown copyright owner $owner\n"; next; } + + next if $type eq "X"; + + # XXXTALE lib/isc/commandline.c should probably also have special handling. $before_copyright = ""; $c_comment = 0; @@ -121,18 +140,24 @@ while (<>) { if ($c_comment) { print TARGET "/*\n"; } - print TARGET "${prefix}Copyright (C) "; + + $years = ""; $first_year = 1; foreach $year (@years) { if (! $first_year) { - print TARGET ", "; + $years .= ", "; } - print TARGET "$year"; + $years .= "$year"; $first_year = 0; } - print TARGET " Internet Software Consortium.\n"; - print TARGET "$prefix\n"; - foreach $_ (@copyright_text) { + + ($firstline, @otherlines) = @$textp; + + $firstline =~ s/\@YEARS\@/$years/; + + print TARGET "$prefix$firstline"; + + foreach $_ (@otherlines) { print TARGET "${prefix}$_"; } if ($c_comment) {