[prev in list] [next in list] [prev in thread] [next in thread]
List: fdo-commits
Subject: [fdo-commits] r7439 - trunk/Thirdparty/openssl/util
From: svn_fdo () osgeo ! org
Date: 2015-12-10 15:07:38
Message-ID: 20151210150738.806A23901A2 () trac ! osgeo ! org
[Download RAW message or body]
Author: kwi
Date: 2015-12-10 07:07:38 -0800 (Thu, 10 Dec 2015)
New Revision: 7439
Added:
trunk/Thirdparty/openssl/util/copy-if-different.pl
Log:
RFC #70: VS 2015 - merge sandbox to trunk: thirdparty\openssl
Add one missing file
Added: trunk/Thirdparty/openssl/util/copy-if-different.pl
===================================================================
--- trunk/Thirdparty/openssl/util/copy-if-different.pl (rev 0)
+++ trunk/Thirdparty/openssl/util/copy-if-different.pl 2015-12-10 15:07:38 UTC (rev 7439)
@@ -0,0 +1,78 @@
+#!/usr/local/bin/perl
+
+use strict;
+
+use Fcntl;
+
+# copy-if-different.pl
+
+# Copy to the destination if the source is not the same as it.
+
+my @filelist;
+
+foreach my $arg (@ARGV) {
+ $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
+ foreach (glob $arg)
+ {
+ push @filelist, $_;
+ }
+}
+
+my $fnum = @filelist;
+
+if ($fnum <= 1)
+ {
+ die "Need at least two filenames";
+ }
+
+my $dest = pop @filelist;
+
+if ($fnum > 2 && ! -d $dest)
+ {
+ die "Destination must be a directory";
+ }
+
+foreach (@filelist)
+ {
+ my $dfile;
+ if (-d $dest)
+ {
+ $dfile = $_;
+ $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
+ $dfile = "$dest/$dfile";
+ }
+ else
+ {
+ $dfile = $dest;
+ }
+
+ my $buf;
+ if (-f $dfile)
+ {
+ sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
+ sysopen(OUT, $dfile, O_RDONLY|O_BINARY)
+ || die "Can't Open $dfile";
+ while (sysread IN, $buf, 10240)
+ {
+ my $b2;
+ goto copy if !sysread(OUT, $b2, 10240) || $buf ne $b2;
+ }
+ goto copy if sysread(OUT, $buf, 1);
+ close(IN);
+ close(OUT);
+ print "NOT copying: $_ to $dfile\n";
+ next;
+ }
+ copy:
+ sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
+ sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)
+ || die "Can't Open $dfile";
+ while (sysread IN, $buf, 10240)
+ {
+ syswrite(OUT, $buf, length($buf));
+ }
+ close(IN);
+ close(OUT);
+ print "Copying: $_ to $dfile\n";
+ }
+
_______________________________________________
fdo-commits mailing list
fdo-commits@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fdo-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic