]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/blame - tools/langdiff.pl
ruleset-sources: Add additional providers.
[people/stevee/ipfire-2.x.git] / tools / langdiff.pl
CommitLineData
33e64584
AM
1#!/usr/bin/perl
2
3my @one=();
4my @two=();
5
6my $file1;
7my $file2;
8my $cnt=0;
9my $numArgs = $#ARGV + 1;
10if ($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
18open(FILE1, $file1) or die 'Unable to open file $file1.';
19my @one = <FILE1>;
20close(FILE1);
21undef ($one[0]);
22undef ($one[1]);
23undef ($one[2]);
24undef ($one[3]);
25undef ($one[$#one-1]);
26undef ($one[$#one-2]);
27open(FILE2, $file2) or die 'Unable to open file $file2.';
28my @two = <FILE2>;
29close(FILE2);
30undef ($two[0]);
31undef ($two[1]);
32undef ($two[2]);
33undef ($two[3]);
34undef ($two[$#two-1]);
35undef ($two[$#two-2]);
36open(FILE3, ">language-diff.txt") or die 'Unable to open config file.';
37
38foreach 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
46sub 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
57print"$cnt lines from $file2 are not existent in $file1. Please check language-diff.txt for details.\n\n";