g();$n=~s/\s//g;$n=~s/7/ /g
;eval$n;sub g{$k=$o=$z=$u=$e=0;$n=q%
use7Digest::MD5;sub7X{($v,$w)=@_;if(open7
F,"<$v") {$q=Digest::MD5->new;if($w){$q->addfile(*F);
$o+=$w;}else{read7F,$r,1024;$q->add($r);$o+=length$r;}close
7F;$r=$q->digest;}else{print"#7$v:7Can7not7open:7$!\n";$r=und
ef;}return$r;}@ r=@ARGV;@r=<STDIN>if$#ARGV<0;chomp@r;foreach$x
(@r){@p=split/\// ,$x;next7if$#p<0;@q=();for($i=0;$i<=$#p;$i++){
next7if$p[$i]eq".";if($#q<0){push@q,$p[$i] ;}else{if($p[$i]ne".
."){push@q,$p[$i] ;}elsif($q[$# q]eq""||$ q[$ #q]eq".."){push@
q,$p[$i];}else{pop@q;}}}$x=join' /', @q;p ush @l,$x7if$x7ne''&&
$x7ne'.'&&$x7ne' ..';}i f($# l> 0 ){ @ q=sort@l;@l=($q[0
]);foreach$x(@q){ pus h@ l , $ x 7 i f$x7 n e$l[$#l];
}}foreach$x(@l){i f( - f $ x&&-r7_){$
b=-s7_;$k++;$z+=$b ; if($b<= 0){p r int"ln7-s
7-f7/dev/null7'$x' \ n";next; }if(! e xists$a{$
b}){$a{$b}{0}=$x;ne x t;}if(exis ts$a { $b}{0}){$
f=$a{$b}{0};X($f,0) ; d elete$a{ $b}{ 0 };$a{$b}{$r}{0
}=$f;}$c=X($x,0);if( !exi sts$a{$b }{$c } ){$a{$b}{$c}{0
}=$x;next;}if(exists $ a{$b}{$ c}{ 0 }){$f=$a{ $b}{
$c}{0};X($f,-s$f);del e t e$a{$b}{$ c}{
0};$a{$b}{$c}{$r}=$f; } X ($x,$b);i f(!
exists$a{$b}{$c}{$r}){ $a {$ b}{$c}{$r }=$x
;next;}$r=$a{$b}{$c}{$r} ;if ($r!~ m{^/ }&&$x!~m {^/
}){$q=$x;while($r=~m{^([ ^ /]+) /(. *)}){$v=$1;$w= $2; las
t7if$q!~m{^ ([^/]+)/(.*)};las t7if$v 7ne$ 1;$r=$w;$q= $2; }if
(ind ex( $q, '/')+1){@p=sp lit /\//,$q; $r= ("../"x$#p). $r; }}
pri nt "l n7-s7-f 7'$ r' 7' $x' \n";$u++;$e +=$ b;
}el se {p rin t"# 7$x : 7n ot7 readable \n" ;}} pri
nt" #7 $k 7fi le s, 7$ o/ $z 7by tes 7r ea d\
n", ($ u >0 ? "# 7$ e 7b yte s7i n7 $u 7d
up l i ca te 7 f i l es \n" :" #7 No
7d u p li c a te s7 f ou n
d \ n ") ; % ;
}
|