zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: "typeset -x" acts as if "-g"
Date: Fri, 19 Nov 1999 04:11:45 +0000	[thread overview]
Message-ID: <991119041146.ZM10235@candle.brasslantern.com> (raw)

This change should make "typeset -x" completely equivalent to "export", as
it was before the "-g" option was introduced some while ago.  Note that you
still can't export a local, so neither "export FOO" nor "typeset -x FOO"
changes the environment if there's a local FOO in some surrounding scope.

I looked at lifting that restriction in sh/ksh emulation modes, but I need
to find out why the addenv() in restore_params() doesn't do what I expect.

Index: Src/builtin.c
===================================================================
@@ -1857,7 +1857,7 @@
 	return 0;
     }
 
-    if (!ops['g'])
+    if (!ops['g'] && !ops['x'])
 	on |= PM_LOCAL;
 
     if (on & PM_TIED) {
@@ -1895,7 +1895,7 @@
 	 */
 	if ((pm = (Param) paramtab->getnode(paramtab, asg0.name))
 	    && !(pm->flags & PM_UNSET)
-	    && (locallevel == pm->level || func == BIN_EXPORT)) {
+	    && (locallevel == pm->level || !(on & PM_LOCAL))) {
 	    if (!asg0.value && !(PM_TYPE(pm->flags) & (PM_ARRAY|PM_HASHED)))
 		oldval = ztrdup(getsparam(asg0.name));
 	    on |= (pm->flags & PM_EXPORTED);

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


                 reply	other threads:[~1999-11-19  9:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=991119041146.ZM10235@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).