summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-11-06 21:15:18 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-11-06 21:15:18 +0000
commit9281bc5381cfb7a11cc6470de4a4766c4ff8f771 (patch)
tree1d8973295d77244e0dda330dcbcaa4a99643095f /perl-install
parent78a6a2c2496a9fb29d7af2d92b2d1a6254802e3a (diff)
downloaddrakx-9281bc5381cfb7a11cc6470de4a4766c4ff8f771.tar
drakx-9281bc5381cfb7a11cc6470de4a4766c4ff8f771.tar.gz
drakx-9281bc5381cfb7a11cc6470de4a4766c4ff8f771.tar.bz2
drakx-9281bc5381cfb7a11cc6470de4a4766c4ff8f771.tar.xz
drakx-9281bc5381cfb7a11cc6470de4a4766c4ff8f771.zip
(cp): use cp_af
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/commands.pm38
1 files changed, 2 insertions, 36 deletions
diff --git a/perl-install/commands.pm b/perl-install/commands.pm
index f3503eb10..3808d6848 100644
--- a/perl-install/commands.pm
+++ b/perl-install/commands.pm
@@ -222,42 +222,8 @@ sub ls {
}
}
sub cp {
- my ($force) = getopts(\@_, qw(f));
- @_ >= 2 or die "usage: cp [-f] <sources> <dest>\n(this cp does -Rl by default)\n";
-
- my $cp; $cp = sub {
- my $dest = pop @_;
-
- @_ or return;
- @_ == 1 || -d $dest or die "cp: copying multiple files, but last argument ($dest) is not a directory\n";
-
- foreach my $src (@_) {
- my $dest = $dest;
- -d $dest and $dest .= "/" . basename($src);
-
- if (-e $dest) {
- $force ? unlink $dest : die "file $dest already exist\n";
- }
-
- if (-d $src) {
- -d $dest or mkdir $dest, (stat($src))[2] or die "mkdir: can't create directory $dest: $!\n";
- &$cp(glob_($src), $dest);
- } elsif (-l $src) {
- unless (symlink((readlink($src) || die "readlink failed: $!"), $dest)) {
- my $msg = "symlink: can't create symlink $dest: $!\n";
- $force ? warn $msg : die $msg;
- }
- } else {
- local (*F, *G);
- open F, $src or die "can't open $src for reading: $!\n";
- open G, "> $dest" or $force or die "can't create $dest : $!\n";
- local $_;
- while (<F>) { print G $_ }
- chmod((stat($src))[2], $dest);
- }
- }
- };
- &$cp(@_);
+ @_ >= 2 or die "usage: cp <sources> <dest>\n(this cp does -Rfl by default)\n";
+ cp_af(@_);
}
sub ps {