]> git.ipfire.org Git - ipfire-2.x.git/blob - tools/langdiff.pl
transmission: update to 3.00
[ipfire-2.x.git] / tools / langdiff.pl
1 #!/usr/bin/perl
2
3 my @one=();
4 my @two=();
5
6 my $file1;
7 my $file2;
8 my $cnt=0;
9 my $numArgs = $#ARGV + 1;
10 if ($numArgs !=2 ){
11 print"Usage: langdiff.pl <languagefile1 - incomplete> <languagefile2 - complete>\n";
12 exit;
13 }else{
14 $file1=$ARGV[0];
15 $file2=$ARGV[1];
16 }
17
18 open(FILE1, $file1) or die 'Unable to open file $file1.';
19 my @one = <FILE1>;
20 close(FILE1);
21 undef ($one[0]);
22 undef ($one[1]);
23 undef ($one[2]);
24 undef ($one[3]);
25 undef ($one[$#one-1]);
26 undef ($one[$#one-2]);
27 open(FILE2, $file2) or die 'Unable to open file $file2.';
28 my @two = <FILE2>;
29 close(FILE2);
30 undef ($two[0]);
31 undef ($two[1]);
32 undef ($two[2]);
33 undef ($two[3]);
34 undef ($two[$#two-1]);
35 undef ($two[$#two-2]);
36 open(FILE3, ">language-diff.txt") or die 'Unable to open config file.';
37
38 foreach my $line (@two){
39 my ($a,$b) = split ("=>",$line);
40 if(!&is_in_array($a)){
41 $cnt++;
42 print FILE3 "$a => $b";
43 }
44 }
45
46 sub is_in_array{
47 my $val = shift;
48
49 foreach my $line1 (@one){
50 my ($c,$d) = split ("=>",$line1);
51 return 1 if ($val eq $c);
52 }
53 return 0;
54 }
55
56
57 print"$cnt lines from $file2 are not existent in $file1. Please check language-diff.txt for details.\n\n";