another typo: too late at light corrections...:-(
[midnight-commander.git] / po / desk.pl
blob08a2a18a563549348aaddc0269551e46da90f693
1 #!/usr/bin/perl -w
3 # GNOME entry finder utility.
4 # (C) 2000 The Free Software Foundation
5 #
6 # Author(s): Kenneth Christiansen
9 $VERSION = "1.0.0 beta 5";
10 $LANG = $ARGV[0];
11 $OPTION2 = $ARGV[1];
12 $SEARCH = "Name";
14 if (! $LANG){
15 print "desk.pl: missing file arguments\n";
16 print "Try `desk.pl --help' for more information.\n";
17 exit;
20 if ($OPTION2){
21 $SEARCH=$OPTION2;
24 if ($LANG){
26 if ($LANG=~/^-(.)*/){
28 if ("$LANG" eq "--version" || "$LANG" eq "-V"){
29 print "GNOME Entry finder $VERSION\n";
30 print "Written by Kenneth Christiansen <kenneth\@gnome.org>, 2000.\n\n";
31 print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
32 print "This is free software; see the source for copying conditions. There is NO\n";
33 print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
34 exit;
37 elsif ($LANG eq "--help" || "$LANG" eq "-H"){
38 print "Usage: ./desk.pl [OPTIONS] ...LANGCODE ENTRY\n";
39 print "Checks .desktop and alike files for missing translations.\n\n";
40 print " -V, --version shows the version\n";
41 print " -H, --help shows this help page\n";
42 print "\nReport bugs to <kenneth\@gnome.org>.\n";
43 exit;
46 else{
47 print "desk.pl: invalid option -- $LANG\n";
48 print "Try `desk.pl --help' for more information.\n";
49 exit;
53 else{
55 $a="find ../ -print | egrep '.*\\.(desktop|soundlist"
56 ."|directory)' ";
58 $b="find ../ -print | egrep '.*\\.(desktop|soundlist"
59 ."|directory)' ";
61 print "Searching for missing $SEARCH\[$LANG\] entries...\n";
63 open(BUF1, "$a|");
64 open(BUF2, "$b|");
66 @buf1 = <BUF1>;
67 foreach my $file (@buf1){
68 open FILE, "<$file";
69 while (<FILE>) {
70 if ($_=~/$SEARCH\[$LANG\]\=/o){
71 $file = unpack("x2 A*",$file) . "\n";
72 push @buff1, $file;
73 last;
78 @buf2 = <BUF2>;
79 foreach my $file (@buf2){
80 open FILE, "<$file";
81 while (<FILE>) {
82 if ($_=~/$SEARCH\=/o){
83 $file = unpack("x2 A*",$file) . "\n";
84 push @buff2, $file;
85 last;
90 @bufff1 = sort (@buff1);
91 @bufff2 = sort (@buff2);
93 my %in2;
94 foreach (@bufff1) {
95 $in2{$_} = 1;
98 foreach (@bufff2){
99 if (!exists($in2{$_})){
100 push @result, $_ }
104 open(OUT1, ">MISSING.$LANG.$SEARCH");
105 print OUT1 @result ;
106 close OUT1;
109 stat("MISSING.$LANG.$SEARCH");
110 print "\nWell, you need to fix these:\n\n" if -s _;
111 print @result if -s _;
112 print "\nThe list is saved in MISSING.$LANG.$SEARCH\n" if -s _;
113 print "\nWell, it's all perfect! Congratulation!\n" if -z _;
114 unlink "MISSING.$LANG.$SEARCH" if -z _;
115 exit;