From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19141 invoked from network); 15 Dec 1999 18:38:20 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 Dec 1999 18:38:20 -0000 Received: (qmail 19955 invoked by alias); 15 Dec 1999 18:38:16 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9065 Received: (qmail 19947 invoked from network); 15 Dec 1999 18:38:15 -0000 Date: Wed, 15 Dec 1999 13:38:00 -0500 From: Clint Adams To: Bart Schaefer Cc: zsh-workers@sunsite.auc.dk Subject: PATCH: more flexible cd builtin revised Message-ID: <19991215133800.A24646@dman.com> References: <19991213165621.A2898@dman.com> <991215170926.ZM15212@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0i In-Reply-To: <991215170926.ZM15212@candle.brasslantern.com>; from schaefer@candle.brasslantern.com on Wed, Dec 15, 1999 at 05:09:26PM +0000 > if (lchdir(buf, NULL, hard) && lchdir(dest, NULL, hard)) Yes, that makes more sense. Index: Src/builtin.c =================================================================== RCS file: /cvs/zsh/zsh/Src/builtin.c,v retrieving revision 1.1.1.45 diff -u -r1.1.1.45 builtin.c --- Src/builtin.c 1999/12/13 21:57:56 1.1.1.45 +++ Src/builtin.c 1999/12/15 18:35:49 @@ -951,8 +951,11 @@ else unmetafy(buf, &dlen); - if (lchdir(dest, NULL, hard)) /* Try plain relative first */ - if (lchdir(buf, NULL, hard)) { + /* We try the full path first. If that fails, try the + * argument to cd relatively. This is useful if the cwd + * or a parent directory is renamed in the interim. + */ + if (lchdir(buf, NULL, hard) && lchdir(dest, NULL, hard)) { free(buf); return NULL; }