9 # Copy to the destination if the source is not the same as it.
13 foreach my $arg (@ARGV) {
14 $arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
15 $arg = qq("$arg") if ($arg =~ /\s/); # compensate for bug in 5.10...
26 die "Need at least two filenames";
29 my $dest = pop @filelist;
31 if ($fnum > 2 && ! -d $dest)
33 die "Destination must be a directory";
42 $dfile =~ s|^.*[/\\]([^/\\]*)$|$1|;
43 $dfile = "$dest/$dfile";
53 sysopen(IN, $_, O_RDONLY|O_BINARY) || die "Can't Open $_";
54 sysopen(OUT, $dfile, O_RDONLY|O_BINARY)
55 || die "Can't Open $dfile";
56 while (sysread IN, $buf, 10240)
59 goto copy if !sysread(OUT, $b2, 10240) || $buf ne $b2;
61 goto copy if sysread(OUT, $buf, 1);
64 print "NOT copying: $_ to $dfile\n";
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)
73 syswrite(OUT, $buf, length($buf));
77 print "Copying: $_ to $dfile\n";