diff options
| author | djm <> | 2008-09-06 12:15:53 +0000 |
|---|---|---|
| committer | djm <> | 2008-09-06 12:15:53 +0000 |
| commit | 89b182c5db7ea802edfc3ee734b4899b43e13e09 (patch) | |
| tree | 88747ac13b4a3c36ffc2fe9901e1e90efc583ced /src/lib/libcrypto/util/copy.pl | |
| parent | 2264137440a13fb11f05127cb03f7239f024ab28 (diff) | |
| parent | f69b11f62c3e6c9d4db22529933cf93b6301f7b1 (diff) | |
| download | openbsd-89b182c5db7ea802edfc3ee734b4899b43e13e09.tar.gz openbsd-89b182c5db7ea802edfc3ee734b4899b43e13e09.tar.bz2 openbsd-89b182c5db7ea802edfc3ee734b4899b43e13e09.zip | |
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libcrypto/util/copy.pl')
| -rw-r--r-- | src/lib/libcrypto/util/copy.pl | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/lib/libcrypto/util/copy.pl b/src/lib/libcrypto/util/copy.pl new file mode 100644 index 0000000000..e20b45530a --- /dev/null +++ b/src/lib/libcrypto/util/copy.pl | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | use Fcntl; | ||
| 4 | |||
| 5 | |||
| 6 | # copy.pl | ||
| 7 | |||
| 8 | # Perl script 'copy' comment. On Windows the built in "copy" command also | ||
| 9 | # copies timestamps: this messes up Makefile dependencies. | ||
| 10 | |||
| 11 | my $arg; | ||
| 12 | |||
| 13 | foreach $arg (@ARGV) { | ||
| 14 | $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob... | ||
| 15 | foreach (glob $arg) | ||
| 16 | { | ||
| 17 | push @filelist, $_; | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | $fnum = @filelist; | ||
| 22 | |||
| 23 | if ($fnum <= 1) | ||
| 24 | { | ||
| 25 | die "Need at least two filenames"; | ||
| 26 | } | ||
| 27 | |||
| 28 | $dest = pop @filelist; | ||
| 29 | |||
| 30 | if ($fnum > 2 && ! -d $dest) | ||
| 31 | { | ||
| 32 | die "Destination must be a directory"; | ||
| 33 | } | ||
| 34 | |||
| 35 | foreach (@filelist) | ||
| 36 | { | ||
| 37 | if (-d $dest) | ||
| 38 | { | ||
| 39 | $dfile = $_; | ||
| 40 | $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|; | ||
| 41 | $dfile = "$dest/$dfile"; | ||
| 42 | } | ||
| 43 | else | ||
| 44 | { | ||
| 45 | $dfile = $dest; | ||
| 46 | } | ||
| 47 | sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_"; | ||
| 48 | sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY) | ||
| 49 | || die "Can't Open $dfile"; | ||
| 50 | while (sysread IN, $buf, 10240) | ||
| 51 | { | ||
| 52 | syswrite(OUT, $buf, length($buf)); | ||
| 53 | } | ||
| 54 | close(IN); | ||
| 55 | close(OUT); | ||
| 56 | print "Copying: $_ to $dfile\n"; | ||
| 57 | } | ||
| 58 | |||
| 59 | |||
