Make redundant-slash removal more ubiquitous.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 15 Feb 2006 16:04:33 +0000 (16:04 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 15 Feb 2006 16:04:33 +0000 (16:04 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/utils@6560 cda61777-01e9-0310-a592-d414129be87e

lns/lns

diff --git a/lns/lns b/lns/lns
index 4856a85..d44dc8c 100755 (executable)
--- a/lns/lns
+++ b/lns/lns
@@ -117,7 +117,6 @@ if ($multiple) {
 
 sub makelink {
   local ($source, $target) = @_;
-
   # Calculate the absolute path names of both source and target.
   $source = &normalise($source);
   $target = &normalise($target);
@@ -160,7 +159,7 @@ sub normalise {
     1 while s/^(.*)\/\.(\/.*)?$/$1$2/;
 
     # Remove redundant slashes.
-    s/\/+/\//;
+    s/\/+/\//g;
 
     # Remove a trailing slash if present.
     s/\/$//;
@@ -194,6 +193,7 @@ sub normalise {
            $_ = $pre . $post;
        }
        $_ = "/" if $_ eq ""; # special case
+       s/\/+/\//g; # remove redundant slashes again in case link text had any
        $log .= "$_";
        warn "lns: $log\n" if $verbose > 2;
     }