2 ## DOC: cran2deb copy_find path
3 ## DOC: a tool for finding (heuristically) some copyright notices.
9 use File::Find qw(find);
11 my $keywords='\(C\)|©|copyright|warranty|redistribution|modification|patent|trademark|licen[cs]e|permission';
14 find(sub {if (-f $File::Find::name && $File::Find::name !~ /debian/) {push @files,$File::Find::name} },@ARGV);
16 my @missing_copyright;
17 my %copyright_notices;
18 for my $file (@files) {
19 my $fh = IO::File->new($file,'r') or die "Unable to open '$file' for reading: $!";
20 my $has_copyright = 0;
27 if (/\Q$keywords\E/) {
28 $copyright_notices{$_} = $_;
32 if (not $has_copyright) {
33 push @missing_copyright,[$file,$lines,$chars];
36 print "Suspect copyright notices:\n";
37 for my $notice (keys %copyright_notices) {
38 print ' '.$copyright_notices{$notice}."\n";
40 print "Files without *suspect* copyright notices:\n";
41 for my $fr (@missing_copyright) {
42 print ' '.$fr->[0]."\n";
43 print ' '.call_file($fr->[0])."\n";
44 print ' chars:'.$fr->[1]."\n";
45 print ' lines:'.$fr->[2]."\n";
52 open($file_fh,"-|",'file',$file);