about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/prompt.yo6
-rw-r--r--Src/prompt.c5
3 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9dd866c38..b9dfe083c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-29  Peter Stephenson  <pws@csr.com>
+
+	* 20208: Src/prompt.c, Doc/Zsh/prompt.yo: ternary code character C
+	etc. treat / as path with zero elements.
+
 2004-07-28  Peter Stephenson  <pws@csr.com>
 
 	* 20214: Src/parse.c: fix debugging test that didn't work
diff --git a/Doc/Zsh/prompt.yo b/Doc/Zsh/prompt.yo
index cb4609240..2745abb1d 100644
--- a/Doc/Zsh/prompt.yo
+++ b/Doc/Zsh/prompt.yo
@@ -217,11 +217,13 @@ sitem(tt(#))(True if the effective uid of the current process is var(n).)
 sitem(tt(?))(True if the exit status of the last command was var(n).)
 sitem(tt(_))(True if at least var(n) shell constructs were started.)
 sxitem(tt(C))
-sitem(tt(/))(True if the current absolute path has at least var(n) elements.)
+sitem(tt(/))(True if the current absolute path has at least var(n) elements
+relative to the root directory, hence tt(/) is counted as 0 elements.)
 sxitem(tt(c))
 sxitem(tt(.))
 sitem(tt(~))(True if the current path, with prefix replacement, has at
-least var(n) elements.)
+least var(n) elements relative to the root directory, hence tt(/) is
+counted as 0 elements.)
 sitem(tt(D))(True if the month is equal to var(n) (January = 0).)
 sitem(tt(d))(True if the day of the month is equal to var(n).)
 sitem(tt(g))(True if the effective gid of the current process is var(n).)
diff --git a/Src/prompt.c b/Src/prompt.c
index 56d6a76fd..3b16a8e44 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -244,9 +244,12 @@ putpromptchar(int doprint, int endchar)
 		    if ((nd = finddir(ss))) {
 			arg--;
 			ss += strlen(nd->dir);
-		    }
+		    } /*FALLTHROUGH*/
 		case '/':
 		case 'C':
+		    /* `/' gives 0, `/any' gives 1, etc. */
+		    if (*ss++ == '/' && *ss)
+			arg--;
 		    for (; *ss; ss++)
 			if (*ss == '/')
 			    arg--;