From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: globalexport option
Date: Sun, 16 Apr 2000 19:28:58 +0100 [thread overview]
Message-ID: <E12gtmx-00061x-00.2000-04-16-19-28-56@cmailg1.svr.pol.co.uk> (raw)
This implements the option that differentiates between the old kludge for
turning on -g with typeset -x and the more natural code which doesn't.
There's also a patch for Etc/MACHINES to note that OpenBSD works.
Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.3
diff -u -r1.3 builtins.yo
--- Doc/Zsh/builtins.yo 2000/04/13 14:22:47 1.3
+++ Doc/Zsh/builtins.yo 2000/04/16 18:26:52
@@ -1160,9 +1160,10 @@
)
item(tt(-x))(
Mark for automatic export to the environment of subsequently
-executed commands. Currently this implies the option tt(-g), unless tt(+g)
-is also explicitly given, in other words the parameter is not made local to
-the enclosing function. This is for compatibility with other shells.
+executed commands. If the option tt(GLOBAL_EXPORT) is set, this implies
+the option tt(-g), unless tt(+g) is also explicitly given; in other words
+the parameter is not made local to the enclosing function. This is for
+compatibility with previous versions of zsh.
)
enditem()
)
Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.1.1.30
diff -u -r1.1.1.30 options.yo
--- Doc/Zsh/options.yo 2000/02/09 18:58:23 1.1.1.30
+++ Doc/Zsh/options.yo 2000/04/16 18:26:55
@@ -381,6 +381,24 @@
Perform filename generation (globbing).
(See noderef(Filename Generation).)
)
+pindex(GLOBAL_EXPORT)
+cindex(environment, and local parameters)
+item(tt(GLOBAL_EXPORT) (tt<Z>))(
+If this option is set, passing the tt(-x) flag to the builtins tt(declare),
+tt(float), tt(integer), tt(readonly) and tt(typeset) (but not tt(local))
+will also set the tt(-g) flag; hence parameters exported to
+the environment will not be made local to the enclosing function, unless
+they were already or the flag tt(+g) is given explicitly. If the option is
+unset, exported parameters will be made local in just the same way as any
+other parameter.
+
+This option is set by default for backward compatibility; it is not
+recommended that its behaviour be relied upon. Note that the builtin
+tt(export) always sets both the tt(-x) and tt(-g) flags, and hence its
+effect extends beyond the scope of the enclosing function; this is the
+most portable way to achieve this behaviour.
+)
+cindex(exporting, and local parameters)
pindex(GLOBAL_RCS)
cindex(startup files, global, inhibiting)
cindex(files, global startup, inhibiting)
Index: Etc/MACHINES
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/MACHINES,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 MACHINES
--- Etc/MACHINES 2000/03/25 00:21:56 1.1.1.11
+++ Etc/MACHINES 2000/04/16 18:26:55
@@ -98,6 +98,9 @@
Should build `out-of-the-box', but the zsh malloc routines are
not recommended.
+OpenBSD: OpenBSD 2.6
+ Should build `out-of-the-box'.
+
SIEMENS: Reliant UNIX
Builds `out-of-the-box'. Dynamic loading is supported.
Large Files and 64-bit integers are supported as of version 5.44
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.7
diff -u -r1.7 builtin.c
--- Src/builtin.c 2000/04/13 14:22:47 1.7
+++ Src/builtin.c 2000/04/16 18:27:10
@@ -1850,7 +1850,8 @@
return 0;
}
- if ((!ops['g'] && !ops['x']) || ops['g'] == 2 || *name == 'l')
+ if ((!ops['g'] && !ops['x']) || ops['g'] == 2 || *name == 'l' ||
+ !isset(GLOBALEXPORT))
on |= PM_LOCAL;
if (on & PM_TIED) {
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.1.1.21
diff -u -r1.1.1.21 options.c
--- Src/options.c 2000/02/09 01:15:29 1.1.1.21
+++ Src/options.c 2000/04/16 18:27:14
@@ -112,6 +112,7 @@
{NULL, "flowcontrol", OPT_ALL, FLOWCONTROL},
{NULL, "functionargzero", OPT_EMULATE|OPT_NONBOURNE, FUNCTIONARGZERO},
{NULL, "glob", OPT_EMULATE|OPT_ALL, GLOBOPT},
+{NULL, "globalexport", OPT_EMULATE|OPT_ZSH, GLOBALEXPORT},
{NULL, "globalrcs", OPT_ALL, GLOBALRCS},
{NULL, "globassign", OPT_EMULATE|OPT_CSH, GLOBASSIGN},
{NULL, "globcomplete", 0, GLOBCOMPLETE},
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.6
diff -u -r1.6 zsh.h
--- Src/zsh.h 2000/04/14 11:49:32 1.6
+++ Src/zsh.h 2000/04/16 18:27:20
@@ -1344,6 +1344,7 @@
EXTENDEDHISTORY,
FLOWCONTROL,
FUNCTIONARGZERO,
+ GLOBALEXPORT,
GLOBALRCS,
GLOBOPT,
GLOBASSIGN,
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@CambridgeSiliconRadio.com
Web: http://www.pwstephenson.fsnet.co.uk
next reply other threads:[~2000-04-16 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-16 18:28 Peter Stephenson [this message]
2000-04-17 20:32 ` Etc/MACHINES [was Re: PATCH: globalexport option] Clint Adams
2000-04-18 15:25 ` Clint Adams
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=E12gtmx-00061x-00.2000-04-16-19-28-56@cmailg1.svr.pol.co.uk \
--to=pws@pwstephenson.fsnet.co.uk \
--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).