From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: inherit OLDPWD from environment variable
Date: Sun, 21 Jul 2024 21:48:17 +0100 (BST) [thread overview]
Message-ID: <691227988.4882036.1721594897107@mail2.virginmedia.com> (raw)
In-Reply-To: <597238192.4880487.1721590217246@mail2.virginmedia.com>
> On 21/07/2024 20:30 BST Peter Stephenson > Looks fine to me, I'll commit it assuming nobody comes up with any gotchas.
One correction.
diff --git a/Src/init.c b/Src/init.c
index ec21521b1..0aecb5db9 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1245,7 +1245,11 @@ setupvals(char *cmd, char *runscript, char *zsh_name)
pwd = metafy(zgetcwd(), -1, META_DUP);
}
- oldpwd = ztrdup(pwd); /* initialize `OLDPWD' = `PWD' */
+ oldpwd = zgetenv("OLDPWD");
+ if (oldpwd == NULL)
+ oldpwd = ztrdup(pwd); /* initialize `OLDPWD' = `PWD' */
+ else
+ oldpwd = ztrdup(oldpwd);
inittyptab(); /* initialize the ztypes table */
initlextabs(); /* initialize lexing tables */
next prev parent reply other threads:[~2024-07-21 20:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-20 1:55 Franklin Yu
2024-07-20 2:46 ` Lawrence Velázquez
2024-07-20 7:56 ` Franklin Yu
2024-07-21 19:30 ` Peter Stephenson
2024-07-21 20:48 ` Peter Stephenson [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-07-17 7:59 Franklin Yu
2024-07-17 9:02 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=691227988.4882036.1721594897107@mail2.virginmedia.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).