-
-
-###############################################################################
-# Utility subroutines from installperl
-
-sub unlink {
- my(@names) = @_;
- my $cnt = 0;
-
- foreach my $name (@names) {
- next unless -e $name;
- chmod 0777, $name if $^O eq 'os2';
- print " unlink $name\n" if $opts{verbose};
- ( CORE::unlink($name) and ++$cnt
- or warn "Couldn't unlink $name: $!\n" ) unless $opts{notify};
- }
- return $cnt;
-}
-
-sub link {
- my($from,$to) = @_;
- my($success) = 0;
-
- print " ln $from $to\n" if $opts{verbose};
- eval {
- CORE::link($from, $to)
- ? $success++
- : ($from =~ m#^/afs/# || $to =~ m#^/afs/#)
- ? die "AFS" # okay inside eval {}
- : warn "Couldn't link $from to $to: $!\n"
- unless $opts{notify};
- };
- if ($@) {
- File::Copy::copy($from, $to)
- ? $success++
- : warn "Couldn't copy $from to $to: $!\n"
- unless $opts{notify};
- }
- $success;
-}