2 # Copyright 2005-2018 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
15 # Perl script 'copy' comment. On Windows the built in "copy" command also
16 # copies timestamps: this messes up Makefile dependencies.
23 foreach $arg (@ARGV) {
24 if ($arg eq "-stripcr")
29 if ($arg =~ /^-exclude_re=(.*)$/)
34 $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
35 $arg = qq("$arg") if ($arg =~ /\s/); # compensate for bug in 5.10...
36 foreach my $f (glob $arg)
38 push @filelist, $f unless grep { $f =~ /$_/ } @excludes;
46 die "Need at least two filenames";
49 $dest = pop @filelist;
51 if ($fnum > 2 && ! -d $dest)
53 die "Destination must be a directory";
61 $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
62 $dfile = "$dest/$dfile";
68 sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
69 sysopen(OUT, $dfile, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY)
70 || die "Can't Open $dfile";
71 while (sysread IN, $buf, 10240)
77 syswrite(OUT, $buf, length($buf));
81 print "Copying: $_ to $dfile\n";