6 # This file is part of LyX, the document processor.
7 # Licence details can be found in the file COPYING.
9 # author: Kornel Benko, kornel@lyx.org
11 # Remove eventually added CR's from po-file after merging from a Windows OS.
13 # Usage: removeCR.pl *.po
18 use File::Temp qw/ tempfile tempdir /;
19 use File::Copy qw(move);
23 for my $file (@ARGV) {
24 if ($file =~ /\b[a-z][a-z](_[A-Z][A-Z])?\.po$/) {
28 print "Not handled $file\n";
38 print "Checking file $file ... ";
40 if (open(FI, $file)) {
42 my $fh = File::Temp->new(UNLINK => 0);
43 my $tmpname = $fh->filename;
44 while (my $l = <FI>) {
45 while ($l =~ s/\r//) {
53 print "differs from $tmpname --> rewriting\n";
54 move($tmpname, $file);
62 print "Could not read $file\n";