copyright tools

This commit is contained in:
Bob Halley
1998-12-12 20:46:28 +00:00
parent d25afd60ee
commit b897c52f86
4 changed files with 151 additions and 0 deletions

12
util/COPYRIGHT Normal file
View File

@@ -0,0 +1,12 @@
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.
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

50
util/copyrights Normal file
View File

@@ -0,0 +1,50 @@
./bin/tests/mem_test.c 1998
./bin/tests/name_test.c 1998
./bin/tests/rwlock_test.c 1998
./bin/tests/sock_test.c 1998
./bin/tests/task_test.c 1998
./bin/tests/timer_test.c 1998
./lib/dns/include/dns/name.h 1998
./lib/dns/include/dns/result.h 1998
./lib/dns/include/dns/types.h 1998
./lib/dns/name.c 1998
./lib/dns/result.c 1998
./lib/isc/include/isc/assertions.h 1997,1998
./lib/isc/include/isc/boolean.h 1998
./lib/isc/include/isc/buffer.h 1998
./lib/isc/include/isc/error.h 1998
./lib/isc/include/isc/event.h 1998
./lib/isc/include/isc/heap.h 1997,1998
./lib/isc/include/isc/list.h 1997
./lib/isc/include/isc/socket.h 1998
./lib/isc/include/isc/rbtgen.h 1998
./lib/isc/include/isc/region.h 1998
./lib/isc/include/isc/result.h 1998
./lib/isc/include/isc/rwlock.h 1998
./lib/isc/include/isc/task.h 1998
./lib/isc/include/isc/timer.h 1998
./lib/isc/include/isc/mem.h 1997,1998
./lib/isc/pthreads/include/isc/condition.h 1998
./lib/isc/pthreads/include/isc/mutex.h 1998
./lib/isc/pthreads/include/isc/thread.h 1998
./lib/isc/pthreads/condition.c 1998
./lib/isc/unix/include/isc/time.h 1998
./lib/isc/unix/time.c 1998
./lib/isc/win32/include/isc/condition.h 1998
./lib/isc/win32/include/isc/mutex.h 1998
./lib/isc/win32/include/isc/thread.h 1998
./lib/isc/win32/include/isc/time.h 1998
./lib/isc/win32/condition.c 1998
./lib/isc/win32/thread.c 1998
./lib/isc/win32/time.c 1998
./lib/isc/assertions.c 1997,1998
./lib/isc/buffer.c 1998
./lib/isc/error.c 1998
./lib/isc/heap.c 1997,1998
./lib/isc/mem.c 1997,1998
./lib/isc/rbtgen.c 1998
./lib/isc/rwlock.c 1998
./lib/isc/task.c 1998
./lib/isc/timer.c 1998
./lib/isc/result.c 1998
./lib/isc/socket.c 1998

9
util/merge_copyrights Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/local/bin/perl -w
if (@ARGV == 0) {
die "usage: merge_copyrights <copyrights_database>";
}
# Build a list of files, and then merge it into the copyrights database.
# Notice if a file goes away. If the file isn't in the database, add it
# with the current year.

80
util/update_copyrights Normal file
View File

@@ -0,0 +1,80 @@
#!/usr/local/bin/perl -w
if (@ARGV == 0) {
die "usage: update_copyrights <copyright_text>";
}
@copyright_text = ();
open(COPYRIGHT, "<$ARGV[0]") || die "can't open $ARGV[0]: $!";
@copyright_text = <>;
close(COPYRIGHT);
while (<>) {
($file, $years_list) = split(/\s+/);
@years = split(/,/, $years_list);
if ( ! -f $file ) {
print "$file: missing\n";
}
if ($years_list eq "SKIP") {
print "$file: SKIP\n";
next;
}
if ($file =~ /\.[chy]$/) {
$c_comment = 1;
} else {
die "only C comments are supported right now";
}
open(SOURCE, "<$file") || die "can't open $file: $!";
$_ = <SOURCE>;
if (/^\/\*/) {
$_ = <SOURCE>;
if ($_ !~ /[Cc]opyright/) {
print "$file: non-copyright comment\n";
close(SOURCE);
next;
}
if ($_ !~ /\*\//) {
while (<SOURCE>) {
if ($_ =~ /\*\//) {
last;
}
}
}
$first = "";
} else {
$first = $_;
}
open(TARGET, ">$file.new") || die "can't open $file.new: $!";
if ($c_comment) {
print TARGET "/*\n";
$prefix = " * ";
}
print TARGET "${prefix}Copyright (C) ";
$first_year = 1;
foreach $year (@years) {
if (! $first_year) {
print TARGET ", ";
}
print TARGET "$year";
$first_year = 0;
}
print TARGET " Internet Software Consortium.\n";
print TARGET "$prefix\n";
foreach $_ (@copyright_text) {
print TARGET "${prefix}$_";
}
if ($c_comment) {
print TARGET " */\n";
}
if ($first ne "") {
print TARGET $first;
}
while (<SOURCE>) {
print TARGET $_;
}
close(TARGET);
close(SOURCE);
rename("$file", "$file.bak") || die "rename($file, $file.bak): $!";
rename("$file.new", "$file") || die "rename($file.new, $file): $!";
}