From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29487 invoked from network); 19 Nov 1999 09:09:21 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Nov 1999 09:09:21 -0000 Received: (qmail 7165 invoked by alias); 19 Nov 1999 09:02:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8674 Received: (qmail 27557 invoked from network); 19 Nov 1999 04:11:52 -0000 From: "Bart Schaefer" Message-Id: <991119041146.ZM10235@candle.brasslantern.com> Date: Fri, 19 Nov 1999 04:11:45 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: PATCH: "typeset -x" acts as if "-g" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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