diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-07-21 09:34:08 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-07-21 09:34:08 +0000 |
commit | 2c8142351681124e8ce5f8f44a8539ae4e7bbe33 (patch) | |
tree | 5df513dce1227b7f6d165f563f6b550091203a5c /Src | |
parent | 06bdda4fb8aa75dcb30c06e8309b89d7557a6931 (diff) | |
download | zsh-2c8142351681124e8ce5f8f44a8539ae4e7bbe33.tar.gz zsh-2c8142351681124e8ce5f8f44a8539ae4e7bbe33.tar.xz zsh-2c8142351681124e8ce5f8f44a8539ae4e7bbe33.zip |
27181: extend POSIX_CD to handle target directory printing behaviour
Diffstat (limited to 'Src')
-rw-r--r-- | Src/builtin.c | 19 |
1 files changed, 15 insertions, 4 deletions
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) { |