comments rule

This commit is contained in:
Guillaume Morin 2002-01-05 11:27:01 +00:00
parent 52d578a956
commit d1b62c2ece

13
stow.in
View file

@ -40,6 +40,8 @@ $Stow = undef;
$Target = undef;
$Restow = 0;
# FIXME: use Getopt::Long
while (@ARGV && ($_ = $ARGV[0]) && /^-/) {
$opt = $';
shift;
@ -114,10 +116,13 @@ while (@ARGV && ($_ = $ARGV[0]) && /^-/) {
&usage("No packages named") unless @ARGV;
# Changing dirs helps a lot when soft links are used
$current_dir = &getcwd;
if ($Stow) {
chdir($Stow) || die "Cannot chdir to target tree $Stow ($!)\n";
}
# This prevents problems if $Target was supplied as a relative path
$Stow = &getcwd;
chdir($current_dir) || die "Your directory does not seem to exist anymore ($!)\n";
@ -159,6 +164,9 @@ sub CommonParent {
$result;
}
# Find the relative patch between
# two paths given as arguments.
sub RelativePath {
local($a, $b) = @_;
local($c) = &CommonParent($a, $b);
@ -177,6 +185,9 @@ sub RelativePath {
&JoinPaths(@b);
}
# Basically concatenates the paths given
# as arguments
sub JoinPaths {
local(@paths, @parts);
local ($x, $y);
@ -265,6 +276,8 @@ sub Unstow {
$pure = 0;
}
}
# This directory was an initially empty directory therefore
# We do not remove it.
$pure = 0 if $empty;
if ((!$pure || !$targetdir) && @puresubdirs) {
&CoalesceTrees($targetdir, $stow, @puresubdirs);