zsh-workers
 help / color / mirror / code / Atom feed
* Re: Problem with named directories
@ 2005-02-22 17:29 Mika Seppänen
  2005-02-22 18:03 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Seppänen @ 2005-02-22 17:29 UTC (permalink / raw)
  To: zsh-workers

Hi all,

I write yesterday about problems with named directories. If I have 
following definations in my zshenv-file:

export foo="/home/user/dir/bar"
export bar="/fome/user/dir/bar/"

Both work with cd-command, but only foo expands correctly to ~foo (from 
%~ defination in prompt/title/etc). I write simple patch which changes 
cmpdir-function so that it returns zero when only difference between 
strings A and B is that A's last character is slash.

diff -ruN zsh-4.3-20050221/Src/utils.c zsh-work/Src/utils.c
--- zsh-4.3-20050221/Src/utils.c    Tue Feb  1 12:53:18 2005
+++ zsh-work/Src/utils.c    Tue Feb 22 18:57:58 2005
@@ -620,6 +620,10 @@
         return 0;
     if (!*s && *t == '/')
         return 0;
+   if (!*t && *s == '/' && *(s+1) == '\0') {
+       *s = 0;
+       return 0;
+       }
      }
      return 1;
  }

Trailing slashs is removed to ensure that later use of that string 
wouldn't cause overflow.

Mika Seppänen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-22 18:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-22 17:29 Problem with named directories Mika Seppänen
2005-02-22 18:03 ` Peter Stephenson
2005-02-22 18:18   ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).