From d1b62c2ecee4312e8dcbd7dd5fe824af8bf40ec2 Mon Sep 17 00:00:00 2001 From: Guillaume Morin Date: Sat, 5 Jan 2002 11:27:01 +0000 Subject: [PATCH] comments rule --- stow.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/stow.in b/stow.in index e3e0a1e..aee5885 100644 --- a/stow.in +++ b/stow.in @@ -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);