This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [perl #40641] crash with unicode characters in regex comment
[perl5.git] / Porting / manicheck
index 20125d8..9ba8360 100644 (file)
@@ -22,24 +22,32 @@ use strict;
 
 sub help {
   die <<EOF;
-$0: Usage: $0 [-x|-m|-h]
+$0: Usage: $0 [-x|-m|-l|-h]
 -x show only the extra files
 -m show only the missing files
+-l show the files one per line instead of one line
 -h show only this help
 EOF
 }
 
-use vars qw($x $m $h);
+use vars qw($x $m $l $h);
 
 help() if $h;
 
 open(MANIFEST, "MANIFEST") or die "MANIFEST: $!";
 
 my %mani;
+my %mand = qw(. 1);
+use File::Basename qw(dirname);
 
 while (<MANIFEST>) {
   if (/^(\S+)\t+(.+)$/) {
     $mani{$1}++;
+    my $d = dirname($1);
+    while($d ne '.') {
+       $mand{$d}++;
+       $d = dirname($d);
+    }
   } else {
     warn "MANIFEST:$.:$_";
   }
@@ -50,26 +58,29 @@ close(MANIFEST);
 my %find;
 use File::Find;
 find(sub {
-       if(-f $_) {
-        my $f = $File::Find::name;
-        $f =~ s:^\./::;
-        $find{$f}++;
-       }
+       my $n = $File::Find::name;
+       $n =~ s:^\./::;
+       $find{$n}++;
      }, '.' );
 
 my @xtra;
 my @miss;
 
 for (sort keys %find) {
-  push @xtra, $_ unless $mani{$_};
+  push @xtra, $_ unless $mani{$_} || $mand{$_};
 }
 
 for (sort keys %mani) {
   push @miss, $_ unless $find{$_};
 }
 
-printf("%s@xtra\n", $x || $m ? "" : "extra: ")   if @xtra && !$m;
-printf("%s@miss\n", $x || $m ? "" : "missing: ") if @miss && !$x;
+$" = "\n" if $l;
+
+unshift @xtra, "extra:"   if @xtra;
+unshift @miss, "missing:" if @miss;
+
+print "@xtra\n", if @xtra && !$m;
+print "@miss\n"  if @miss && !$x;
 
 exit 0;