zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: "typeset -x" acts as if "-g"
@ 1999-11-19  4:11 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 1999-11-19  4:11 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-11-19  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-19  4:11 PATCH: "typeset -x" acts as if "-g" Bart Schaefer

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).