add -stripcr option to copy.pl from 0.9.8
authorDr. Stephen Henson <steve@openssl.org>
Thu, 3 Feb 2011 14:57:51 +0000 (14:57 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 3 Feb 2011 14:57:51 +0000 (14:57 +0000)
util/copy.pl

index e20b45530a8f5f645ec2717cff6cf8c1e4d0187f..eba6d5815e9cef6b312e71cdee6f5642b2ac06af 100644 (file)
@@ -8,9 +8,16 @@ use Fcntl;
 # Perl script 'copy' comment. On Windows the built in "copy" command also
 # copies timestamps: this messes up Makefile dependencies.
 
 # Perl script 'copy' comment. On Windows the built in "copy" command also
 # copies timestamps: this messes up Makefile dependencies.
 
+my $stripcr = 0;
+
 my $arg;
 
 foreach $arg (@ARGV) {
 my $arg;
 
 foreach $arg (@ARGV) {
+       if ($arg eq "-stripcr")
+               {
+               $stripcr = 1;
+               next;
+               }
        $arg =~ s|\\|/|g;       # compensate for bug/feature in cygwin glob...
        foreach (glob $arg)
                {
        $arg =~ s|\\|/|g;       # compensate for bug/feature in cygwin glob...
        foreach (glob $arg)
                {
@@ -49,6 +56,10 @@ foreach (@filelist)
                                        || die "Can't Open $dfile";
        while (sysread IN, $buf, 10240)
                {
                                        || die "Can't Open $dfile";
        while (sysread IN, $buf, 10240)
                {
+               if ($stripcr)
+                       {
+                       $buf =~ tr/\015//d;
+                       }
                syswrite(OUT, $buf, length($buf));
                }
        close(IN);
                syswrite(OUT, $buf, length($buf));
                }
        close(IN);