Android release v6.5.1b
[xcsoar.git] / test / CRLF_Bug / crlf_to_all.pl
blob4dc007c3f39e3d62f4a0d734554b5e67933a1518
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
5 foreach my $ext (@ARGV) {
7 my $input;
8 open ($input, "original.$ext");
9 my @lines = ();
10 while (<$input>) {
11 chomp;
12 s/\r//g;
13 s/\n//g;
14 push @lines, $_;
16 close $input;
19 output("crlf.$ext", "\r\n", \@lines); # Standard windows
20 output("lf.$ext", "\n", \@lines); # Standard unix
21 output("cr.$ext", "\r", \@lines); # Standard Mac
22 output("lfcr.$ext", "\n\r", \@lines); # Broken
23 output("crcrlf.$ext", "\r\r\n", \@lines);# Very broken
25 exit 0;
27 sub output {
28 my ($filename, $delim, $lines) = @_;
29 my $fileref;
30 open ($fileref, "> $filename");
31 foreach my $line (@$lines) {
32 print $fileref $line . $delim;
34 close $fileref;