etc/services - sync with NetBSD-8
[minix.git] / crypto / external / bsd / openssl / dist / ms / cmp.pl
blob95b257fe4caa74ecf9e4a5f8784065ef2328e502
1 #!/usr/local/bin/perl
3 ($#ARGV == 1) || die "usage: cmp.pl <file1> <file2>\n";
5 open(IN0,"<$ARGV[0]") || die "unable to open $ARGV[0]\n";
6 open(IN1,"<$ARGV[1]") || die "unable to open $ARGV[1]\n";
7 binmode IN0;
8 binmode IN1;
10 $tot=0;
11 $ret=1;
12 for (;;)
14 $n1=sysread(IN0,$b1,4096);
15 $n2=sysread(IN1,$b2,4096);
17 last if ($n1 != $n2);
18 last if ($b1 ne $b2);
19 last if ($n1 < 0);
20 if ($n1 == 0)
22 $ret=0;
23 last;
25 $tot+=$n1;
28 close(IN0);
29 close(IN1);
30 if ($ret)
32 printf STDERR "$ARGV[0] and $ARGV[1] are different\n";
33 @a1=unpack("C*",$b1);
34 @a2=unpack("C*",$b2);
35 for ($i=0; $i<=$#a1; $i++)
37 if ($a1[$i] ne $a2[$i])
39 printf "%02X %02X <<\n",$a1[$i],$a2[$i];
40 last;
43 $nm=$tot+$n1;
44 $tot+=$i+1;
45 printf STDERR "diff at char $tot of $nm\n";
47 exit($ret);