summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Doc/Zsh/options.yo8
-rw-r--r--Src/builtin.c19
3 files changed, 29 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 16ff7d0ae..4a7d4ab6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-21 Peter Stephenson <pws@csr.com>
+
+ * 27181: Doc/Zsh/options.yo, Src/builtin.c: extend POSIX_CD to
+ handle target directory printing behaviour.
+
2009-07-20 Peter Stephenson <pws@csr.com>
* 27178, 27180: Etc/FAQ.yo: as pointed out by Mikael, quoting
@@ -12023,5 +12028,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4748 $
+* $Revision: 1.4749 $
*****************************************************
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 8629a0718..555d416e6 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -130,6 +130,14 @@ ifnzman(noderef(Shell Builtin Commands)).
If the option is set, the shell does not test for directories beneath
the local directory (`tt(.)') until after all directories in tt(cdpath)
have been tested.
+
+Also, if the option is set, the conditions under which the shell
+prints the new directory after changing to it are modified. It is
+no longer restricted to interactive shells (although printing of
+the directory stack with tt(pushd) is still limited to interactive
+shells); and any use of a component of tt(CDPATH), including a `tt(.)' but
+excluding an empty component that is otherwise treated as `tt(.)', causes
+the directory to be printed.
)
pindex(PUSHD_IGNORE_DUPS)
pindex(NO_PUSHD_IGNORE_DUPS)
diff --git a/Src/builtin.c b/Src/builtin.c
index dc39b2a7f..88a54a902 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -972,8 +972,19 @@ cd_do_chdir(char *cnam, char *dest, int hard)
if (!nocdpath)
for (pp = cdpath; *pp; pp++) {
if ((ret = cd_try_chdir(*pp, dest, hard))) {
- if (strcmp(*pp, ".")) {
- doprintdir++;
+ if (isset(POSIXCD)) {
+ /*
+ * For POSIX we need to print the directory
+ * any time CDPATH was used, except in the
+ * special case of an empty segment being
+ * treated as a ".".
+ */
+ if (**pp)
+ doprintdir++;
+ } else {
+ if (strcmp(*pp, ".")) {
+ doprintdir++;
+ }
}
return ret;
}
@@ -1146,8 +1157,8 @@ cd_new_pwd(int func, LinkNode dir, int quiet)
pwd = new_pwd;
set_pwd_env();
- if (isset(INTERACTIVE)) {
- if (func != BIN_CD) {
+ if (isset(INTERACTIVE) || isset(POSIXCD)) {
+ if (func != BIN_CD && isset(INTERACTIVE)) {
if (unset(PUSHDSILENT) && !quiet)
printdirstack();
} else if (doprintdir) {