about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-04-16 19:02:13 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-04-16 19:02:13 +0000
commit5c53fb9500c019d7c0ee553f3daf6c277e6f515a (patch)
treeef5c62d6493caa55109731645f4223d6310dd3ff
parent3dc24fba0978b76feb0a9a1584abf57cd766dcb9 (diff)
downloadzsh-5c53fb9500c019d7c0ee553f3daf6c277e6f515a.tar.gz
zsh-5c53fb9500c019d7c0ee553f3daf6c277e6f515a.tar.xz
zsh-5c53fb9500c019d7c0ee553f3daf6c277e6f515a.zip
10771: new GLOBAL_EXPORT option; successful compilation on OpenBSD
-rw-r--r--ChangeLog9
-rw-r--r--Doc/Zsh/builtins.yo7
-rw-r--r--Doc/Zsh/options.yo389
-rw-r--r--Etc/MACHINES85
-rw-r--r--Src/builtin.c3
-rw-r--r--Src/options.c131
-rw-r--r--Src/zsh.h1
7 files changed, 470 insertions, 155 deletions
diff --git a/ChangeLog b/ChangeLog
index aaa4bf45e..0568efd49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2000-04-16  Peter Stephenson  <pws@pwstephenson.fsnet.co.uk>
+
+	* 10771: Etc/MACHINES: successful compilation on OpenBSD, from
+	Anthony Schneider.
+
+	* 10771: Doc/Zsh/builtins.yo, Doc/Zsh/options.yo, Src/builtin.c,
+	Src/options.c, Src/zsh.h: New option GLOBAL_EXPORT set by default
+	makes typeset -x equivalent to typeset -gx.
+
 2000-04-15  Clint Adams  <schizo@debian.org>
 
 	* 10768: configure.in: DLLDFLAGS for OpenBSD.
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 0eadbc596..4db79c860 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1160,9 +1160,10 @@ This flag has a different meaning when used with tt(-f); see above.
 )
 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()
 )
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 0fdf78e8a..e55ed53bd 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -34,9 +34,24 @@ Some of the single letter option names refer to an option being off,
 in which case the inversion of that name refers to the option being on.
 For example, `tt(PLUS()n)' is the short name of `tt(exec)', and
 `tt(-n)' is the short name of its inversion, `tt(noexec)'.
+
+In strings of single letter options supplied to the shell at startup,
+trailing whitespace will be ignored; for example the string `tt(-f    )'
+will be treated just as `tt(-f)', but the string `tt(-f i)' is an error.
+This is because many systems which implement the `tt(#!)' mechanism for
+calling scripts do not strip trailing whitespace.
+
 texinode(Description of Options)(Option Aliases)(Specifying Options)(Options)
 sect(Description of Options)
 cindex(options, description)
+In the following list, options set by default in all emulations are marked
+<D>; those set by default only in csh, ksh, sh, or zsh emulations are marked
+<C>, <K>, <S>, <Z> as appropriate.  When listing options (by `tt(setopt)',
+`tt(unsetopt)', `tt(set -o)' or `tt(set +o)'), those turned on by default
+appear in the list prefixed with `tt(no)'.  Hence (unless
+tt(KSH_OPTION_PRINT) is set), `tt(setopt)' shows all options whose settings
+are changed from the default.
+
 startitem()
 pindex(ALL_EXPORT)
 cindex(export, automatic)
@@ -44,7 +59,7 @@ item(tt(ALL_EXPORT) (tt(-a), ksh: tt(-a)))(
 All parameters subsequently defined are automatically exported.
 )
 pindex(ALWAYS_LAST_PROMPT)
-item(tt(ALWAYS_LAST_PROMPT))(
+item(tt(ALWAYS_LAST_PROMPT) <D>)(
 If unset, key functions that list completions try to return to the last
 prompt if given a numeric argument. If set these functions try to
 return to the last prompt if given em(no) numeric argument.
@@ -58,7 +73,7 @@ a single match is inserted or menu completion is performed.
 )
 pindex(APPEND_HISTORY)
 cindex(history, appending to a file)
-item(tt(APPEND_HISTORY))(
+item(tt(APPEND_HISTORY) <D>)(
 If this is set, zsh sessions will append their history list to
 the history file, rather than overwrite it. Thus, multiple parallel
 zsh sessions will all have their history lists added to the
@@ -73,12 +88,12 @@ command to that directory.
 )
 pindex(AUTO_LIST)
 cindex(completion, listing choices)
-item(tt(AUTO_LIST) (tt(-9)))(
+item(tt(AUTO_LIST) (tt(-9)) <D>)(
 Automatically list choices on an ambiguous completion.
 )
 pindex(AUTO_MENU)
 cindex(completion, menu)
-item(tt(AUTO_MENU))(
+item(tt(AUTO_MENU) <D>)(
 Automatically use menu completion after the second consecutive request for
 completion, for example by pressing the tab key repeatedly. This option
 is overridden by tt(MENU_COMPLETE).
@@ -94,7 +109,7 @@ is performed on a word starting with `tt(~)'.
 (Otherwise, the parameter must be used in the form `tt(~)var(param)' first.)
 )
 pindex(AUTO_PARAM_KEYS)
-item(tt(AUTO_PARAM_KEYS))(
+item(tt(AUTO_PARAM_KEYS) <D>)(
 If a parameter name was completed and a following character
 (normally a space) automatically
 inserted, and the next character typed is one
@@ -105,7 +120,7 @@ Completion in a brace expansion is affected similarly: the added character
 is a `tt(,)', which will be removed if `tt(})' is typed next.
 )
 pindex(AUTO_PARAM_SLASH)
-item(tt(AUTO_PARAM_SLASH))(
+item(tt(AUTO_PARAM_SLASH) <D>)(
 If a parameter is completed whose content is the name of a directory,
 then add a trailing slash instead of a space.
 )
@@ -117,9 +132,10 @@ Make tt(cd) push the old directory onto the directory stack.
 )
 pindex(AUTO_REMOVE_SLASH)
 cindex(slash, removing trailing)
-item(tt(AUTO_REMOVE_SLASH))(
+item(tt(AUTO_REMOVE_SLASH) <D>)(
 When the last character resulting from a completion is a slash and the next
-character typed is a word delimiter or a slash, remove the slash.
+character typed is a word delimiter, a slash, or a character that ends 
+a command (such as a semicolon or an ampersand), remove the slash.
 )
 pindex(AUTO_RESUME)
 cindex(jobs, resuming automatically)
@@ -131,36 +147,47 @@ as candidates for resumption of an existing job.
 pindex(BAD_PATTERN)
 cindex(globbing, bad pattern)
 cindex(filename generation, bad pattern)
-item(tt(BAD_PATTERN) (tt(PLUS()2)))(
+item(tt(BAD_PATTERN) (tt(PLUS()2)) <C> <Z>)(
 If a pattern for filename generation is badly formed, print an error message.
 (If this option is unset, the pattern will be left unchanged.)
 )
 pindex(BANG_HIST)
 cindex(history, enable substitution)
 cindex(enable history substitution)
-item(tt(BANG_HIST) (tt(PLUS()K)))(
-Perform textual history substitution, bf(csh)-style,
+item(tt(BANG_HIST) (tt(PLUS()K)) <C> <Z>)(
+Perform textual history expansion, bf(csh)-style,
 treating the character `tt(!)' specially.
 )
 pindex(BARE_GLOB_QUAL)
 cindex(globbing qualifiers, enable)
 cindex(enable globbing qualifiers)
-item(tt(BARE_GLOB_QUAL))(
+item(tt(BARE_GLOB_QUAL) <Z>)(
 In a glob pattern, treat a trailing set of parentheses as a qualifier
 list, if it contains no `tt(|)', `tt(LPAR())' or (if special) `tt(~)'
 characters.  See noderef(Filename Generation).
 )
+pindex(BASH_AUTO_LIST)
+cindex(completion, listing choices, bash style)
+item(tt(BASH_AUTO_LIST))(
+On an ambiguous completion, automatically list choices when the
+completion function is called twice in succession.  This takes
+precedence over tt(AUTO_LIST).  The setting of tt(LIST_AMBIGUOUS) is
+respected.  If tt(AUTO_MENU) is set, the menu behaviour will then start
+with the third press.  Note that this will not work with
+tt(MENU_COMPLETE), since repeated completion calls immediately cycle
+through the list in that case.
+)
 pindex(BEEP)
 cindex(beep, enabling)
 cindex(enabling the beep)
-item(tt(BEEP) (tt(PLUS()B)))(
+item(tt(BEEP) (tt(PLUS()B)) <D>)(
 Beep on error in ZLE.
 )
 pindex(BG_NICE)
 cindex(jobs, background priority)
 cindex(background jobs, priority of)
 cindex(priority of background jobs)
-item(tt(BG_NICE) (tt(-6)))(
+item(tt(BG_NICE) (tt(-6)) <C> <Z>)(
 Run all background jobs at a lower priority.  This option
 is set by default.
 )
@@ -174,7 +201,7 @@ noderef(Brace Expansion).
 )
 pindex(BSD_ECHO)
 cindex(echo, BSD compatible)
-item(tt(BSD_ECHO))(
+item(tt(BSD_ECHO) <S>)(
 Make the tt(echo) builtin compatible with the BSD manref(echo)(1) command.
 This disables backslashed escape sequences in echo strings unless the
 tt(-e) option is specified.
@@ -187,16 +214,43 @@ tt(AUTO_CD) option set) is not a directory, and does not begin with a
 slash, try to expand the expression as if it were preceded by a `tt(~)' (see
 noderef(Filename Expansion)).
 )
+pindex(CHASE_DOTS)
+cindex(cd, with .. in argument)
+item(tt(CHASE_DOTS))(
+When changing to a directory containing a path segment `tt(..)' which would
+otherwise be treated as cancelling the previous segment in the path (in
+other words, `tt(foo/..)' would be removed from the path, or if `tt(..)' is
+the first part of the path, the last part of tt($PWD) would be deleted),
+instead resolve the path to the physical directory.  This option is
+overridden by tt(CHASE_LINKS).
+
+For example, suppose tt(/foo/bar) is a link to the directory tt(/alt/rod).
+Without this option set, `tt(cd /foo/bar/..)' changes to tt(/foo); with it
+set, it changes to tt(/alt).  The same applies if the current directory
+is tt(/foo/bar) and `tt(cd ..)' is used.  Note that all other symbolic
+links in the path will also be resolved.
+)
 pindex(CHASE_LINKS)
 cindex(links, symbolic)
 cindex(symbolic links)
 item(tt(CHASE_LINKS) (tt(-w)))(
 Resolve symbolic links to their true values when changing directory.
+This also has the effect of tt(CHASE_DOTS), i.e. a `tt(..)' path segment
+will be treated as referring to the physical parent, even if the preceeding
+path segment is a symbolic link.
+)
+pindex(CHECK_JOBS)
+cindex(exiting, checking jobs when)
+cindex(logging out, checking jobs when)
+item(tt(CHECK_JOBS) <Z>)(
+Report the status of background and suspended jobs before exiting a shell
+with job control.  tt(NO_CHECK_JOBS) is best used only in combination with
+tt(NO_HUP), else such jobs will be killed automatically.
 )
 pindex(CLOBBER)
 cindex(clobbering, of files)
 cindex(file clobbering, allowing)
-item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)))(
+item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)) <D>)(
 Allows `tt(>)' redirection to truncate existing files,
 and `tt(>>)' to create files.
 Otherwise `tt(>!)' or `tt(>|)' must be used to truncate a file,
@@ -227,7 +281,7 @@ Try to correct the spelling of all arguments in a line.
 pindex(CSH_JUNKIE_HISTORY)
 cindex(csh, history style)
 cindex(history style, csh)
-item(tt(CSH_JUNKIE_HISTORY))(
+item(tt(CSH_JUNKIE_HISTORY) <C>)(
 A history reference without an event specifier will always refer to the
 previous command.  Without this option, such a history reference refers
 to the same event as the previous history reference, defaulting to the
@@ -236,14 +290,14 @@ previous command.
 pindex(CSH_JUNKIE_LOOPS)
 cindex(csh, loop style)
 cindex(loop style, csh)
-item(tt(CSH_JUNKIE_LOOPS))(
+item(tt(CSH_JUNKIE_LOOPS) <C>)(
 Allow loop bodies to take the form `var(list); tt(end)' instead of
 `tt(do) var(list); tt(done)'.
 )
 pindex(CSH_JUNKIE_QUOTES)
 cindex(csh, quoting style)
 cindex(quoting style, csh)
-item(tt(CSH_JUNKIE_QUOTES))(
+item(tt(CSH_JUNKIE_QUOTES) <C>)(
 Changes the rules for single- and double-quoted text to match that of
 bf(csh).  These require that embedded newlines be preceded by a backslash;
 unescaped newlines will cause an error message.
@@ -251,11 +305,21 @@ In double-quoted strings, it is made impossible to escape `tt($)', `tt(`)'
 or `tt(")' (and `tt(\)' itself no longer needs escaping).
 Command substitutions are only expanded once, and cannot be nested.
 )
+pindex(CSH_NULLCMD)
+vindex(NULLCMD, ignoring)
+vindex(READNULLCMD, ignoring)
+cindex(redirections with no command, csh)
+cindex(csh, redirections with no command)
+item(tt(CSH_NULLCMD) <C>)(
+Do not use the values of tt(NULLCMD) and tt(READNULLCMD) 
+when running redirections with no command.  This make 
+such redirections fail (see noderef(Redirection)).
+)
 pindex(CSH_NULL_GLOB)
 cindex(csh, null globbing style)
 cindex(null globbing style, csh)
 cindex(globbing, null, style, csh)
-item(tt(CSH_NULL_GLOB))(
+item(tt(CSH_NULL_GLOB) <C>)(
 If a pattern for filename generation has no matches,
 delete the pattern from the argument list;
 do not report an error unless all the patterns
@@ -263,9 +327,9 @@ in a command have no matches.
 Overrides tt(NULL_GLOB).
 )
 pindex(EQUALS)
-cindex(filename substitution, =)
-item(tt(EQUALS))(
-Perform tt(=) filename substitution.
+cindex(filename expansion, =)
+item(tt(EQUALS) <Z>)(
+Perform tt(=) filename expansion.
 (See noderef(Filename Expansion).)
 )
 pindex(ERR_EXIT)
@@ -277,7 +341,7 @@ scripts.
 )
 pindex(EXEC)
 cindex(command execution, enabling)
-item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)))(
+item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)) <D>)(
 Do execute commands.  Without this option, commands are
 read and checked for syntax errors, but not executed.
 )
@@ -290,33 +354,62 @@ always produces named directory expansion.)
 )
 pindex(EXTENDED_HISTORY)
 cindex(history, timestamping)
-item(tt(EXTENDED_HISTORY))(
-Save beginning and ending timestamps to the history file.
-The format of these timestamps is
-`tt(:)var(<beginning time>)tt(:)var(<ending time>)tt(:)var(<command>)'.
+item(tt(EXTENDED_HISTORY) <C>)(
+Save each command's beginning timestamp (in seconds since the epoch)
+and the duration (in seconds) to the history file.  The format of
+this prefixed data is:
+
+`tt(:)var(<beginning time>)tt(:)var(<elapsed seconds>)tt(:)var(<command>)'.
 )
 pindex(FLOW_CONTROL)
 cindex(flow control)
-item(tt(FLOW_CONTROL))(
+item(tt(FLOW_CONTROL) <D>)(
 If this option is unset,
 output flow control via start/stop characters (usually assigned to
 ^S/^Q) is disabled in the shell's editor.
 )
 pindex(FUNCTION_ARGZERO)
 cindex($0, setting)
-item(tt(FUNCTION_ARGZERO))(
+item(tt(FUNCTION_ARGZERO) <C> <Z>)(
 When executing a shell function or sourcing a script, set tt($0)
 temporarily to the name of the function/script.
 )
 pindex(GLOB)
 cindex(globbing, enabling)
 cindex(enabling globbing)
-item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)))(
+item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)) <D>)(
 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)
+item(tt(GLOBAL_RCS) (tt(-d)) <D>)(
+If this option is unset, the startup files tt(/etc/zprofile),
+tt(/etc/zshrc), tt(/etc/zlogin) and tt(/etc/zlogout) will not be run.  It
+can be disabled and re-enabled at any time, including inside local startup
+files (tt(.zshrc), etc.).
+)
 pindex(GLOB_ASSIGN)
-item(tt(GLOB_ASSIGN))(
+item(tt(GLOB_ASSIGN) <C>)(
 If this option is set, filename generation (globbing) is
 performed on the right hand side of scalar parameter assignments of
 the form `var(name)tt(=)var(pattern) (e.g. `tt(foo=*)').
@@ -331,11 +424,12 @@ will be an array or a scalar.
 pindex(GLOB_COMPLETE)
 item(tt(GLOB_COMPLETE))(
 When the current word has a glob pattern, do not insert all the words
-resulting from the expansion but cycle through them like
-tt(MENU_COMPLETE). If no matches are found, a `tt(*)' is added to the end of the
-word or inserted at the cursor if tt(COMPLETE_IN_WORD) is set, and expansion
-is attempted again.  Using patterns works not only for files but for all
-completions, such as options, user names, etc.
+resulting from the expansion but generate matches as for completion and
+cycle through them like tt(MENU_COMPLETE). The matches are generated as if
+a `tt(*)' was added to the end of the word, or inserted at the cursor when
+tt(COMPLETE_IN_WORD) is set.  This actually uses pattern matching, not
+globbing, so it works not only for files but for any completion, such as
+options, user names, etc.
 )
 pindex(GLOB_DOTS)
 cindex(globbing, of . files)
@@ -343,8 +437,8 @@ item(tt(GLOB_DOTS) (tt(-4)))(
 Do not require a leading `tt(.)' in a filename to be matched explicitly.
 )
 pindex(GLOB_SUBST)
-item(tt(GLOB_SUBST))(
-Treat any characters resulting from parameter substitution as being
+item(tt(GLOB_SUBST) <C> <K> <S>)(
+Treat any characters resulting from parameter expansion as being
 eligible for file expansion and filename generation, and any
 characters resulting from command substitution as being eligible for
 filename generation.
@@ -352,7 +446,7 @@ filename generation.
 pindex(HASH_CMDS)
 cindex(hashing, of commands)
 cindex(command hashing)
-item(tt(HASH_CMDS))(
+item(tt(HASH_CMDS) <D>)(
 Note the location of each command the first time it is executed.
 Subsequent invocations of the same command will use the
 saved location, avoiding a path search.
@@ -361,13 +455,13 @@ If this option is unset, no path hashing will be done at all.
 pindex(HASH_DIRS)
 cindex(hashing, of directories)
 cindex(directories, hashing)
-item(tt(HASH_DIRS))(
+item(tt(HASH_DIRS) <D>)(
 Whenever a command is executed, hash the directory containing it,
 as well as all directories that occur earlier in the path.
 Has no effect if tt(HASH_CMDS) is unset.
 )
 pindex(HASH_LIST_ALL)
-item(tt(HASH_LIST_ALL))(
+item(tt(HASH_LIST_ALL) <D>)(
 Whenever a command completion is attempted, make sure the entire
 command path is hashed first.  This makes the first completion slower.
 )
@@ -379,10 +473,35 @@ references to clobber files even when tt(CLOBBER) is unset.
 pindex(HIST_BEEP)
 cindex(history beeping)
 cindex(beep, history)
-item(tt(HIST_BEEP))(
+item(tt(HIST_BEEP) <D>)(
 Beep when an attempt is made to access a history entry which
 isn't there.
 )
+pindex(HIST_EXPIRE_DUPS_FIRST)
+cindex(history, expiring duplicates)
+item(tt(HIST_EXPIRE_DUPS_FIRST))(
+If the internal history needs to be trimmed to add the current command line,
+setting this option will cause the oldest history event that has a duplicate
+to be lost before losing a unique event from the list.
+You should be sure to set the value of tt(HISTSIZE) to a larger number
+than tt(SAVEHIST) in order to give you some room for the duplicated
+events, otherwise this option will behave just like
+tt(HIST_IGNORE_ALL_DUPS) once the history fills up with unique events.
+)
+pindex(HIST_FIND_NO_DUPS)
+cindex(history, ignoring duplicates in search)
+item(tt(HIST_FIND_NO_DUPS))(
+When searching for history entries in the line editor, do not display
+duplicates of a line previously found, even if the duplicates are not
+contiguous.
+)
+pindex(HIST_IGNORE_ALL_DUPS)
+cindex(history, ignoring all duplicates)
+item(tt(HIST_IGNORE_ALL_DUPS))(
+If a new command line being added to the history list duplicates an
+older one, the older command is removed from the list (even if it is
+not the previous event).
+)
 pindex(HIST_IGNORE_DUPS)
 cindex(history, ignoring duplicates)
 item(tt(HIST_IGNORE_DUPS) (tt(-h)))(
@@ -409,16 +528,21 @@ item(tt(HIST_REDUCE_BLANKS))(
 Remove superfluous blanks from each command line
 being added to the history list.
 )
+pindex(HIST_SAVE_NO_DUPS)
+item(tt(HIST_SAVE_NO_DUPS))(
+When writing out the history file, older commands that duplicate
+newer ones are omitted.
+)
 pindex(HIST_VERIFY)
 cindex(history, verifying substitution)
 item(tt(HIST_VERIFY))(
-Whenever the user enters a line with history substitution,
+Whenever the user enters a line with history expansion,
 don't execute the line directly; instead, perform
-history substitution and reload the line into the editing buffer.
+history expansion and reload the line into the editing buffer.
 )
 pindex(HUP)
 cindex(jobs, HUP)
-item(tt(HUP))(
+item(tt(HUP) <Z>)(
 Send the tt(HUP) signal to running jobs when the
 shell exits.
 )
@@ -426,7 +550,7 @@ pindex(IGNORE_BRACES)
 cindex(disabling brace expansion)
 cindex(brace expansion, disabling)
 cindex(expansion, brace, disabling)
-item(tt(IGNORE_BRACES) (tt(-I)))(
+item(tt(IGNORE_BRACES) (tt(-I)) <S>)(
 Do not perform brace expansion.
 )
 pindex(IGNORE_EOF)
@@ -437,6 +561,15 @@ of tt(exit) or tt(logout) instead.
 However, ten consecutive EOFs will cause the shell to exit anyway,
 to avoid the shell hanging if its tty goes away.
 )
+pindex(INC_APPEND_HISTORY)
+cindex(history, incremental appending to a file)
+item(tt(INC_APPEND_HISTORY))(
+This options works like tt(APPEND_HISTORY) except that new history lines
+are added to the tt($HISTFILE) incrementally (as soon as they are
+entered), rather than waiting until the shell is killed.
+The file is periodically trimmed to the number of lines specified by
+tt($SAVEHIST), but can exceed this value between trimmings.
+)
 pindex(INTERACTIVE)
 item(tt(INTERACTIVE) (tt(-i), ksh: tt(-i)))(
 This is an interactive shell.  This option is set upon initialisation if
@@ -448,14 +581,14 @@ The value of this option cannot be changed anywhere other than the command line.
 )
 pindex(INTERACTIVE_COMMENTS)
 cindex(comments, in interactive shells)
-item(tt(INTERACTIVE_COMMENTS) (tt(-k)))(
+item(tt(INTERACTIVE_COMMENTS) (tt(-k)) <K> <S>)(
 Allow comments even in interactive shells.
 )
 pindex(KSH_ARRAYS)
 cindex(arrays, ksh style)
 cindex(array style, ksh)
 cindex(ksh, array style)
-item(tt(KSH_ARRAYS))(
+item(tt(KSH_ARRAYS) <K> <S>)(
 Emulate bf(ksh) array handling as closely as possible.  If this option
 is set, array elements are numbered from zero, an array parameter
 without subscript refers to the first element instead of the whole array,
@@ -463,7 +596,7 @@ and braces are required to delimit a subscript (`tt(${path[2]})' rather
 than just `tt($path[2])').
 )
 pindex(KSH_AUTOLOAD)
-item(tt(KSH_AUTOLOAD))(
+item(tt(KSH_AUTOLOAD) <K> <S>)(
 Emulate bf(ksh) function autoloading.  This means that when a function is
 autoloaded, the corresponding file is merely executed, and must define
 the function itself.  (By default, the function is defined to the contents
@@ -472,7 +605,7 @@ containing only a simple definition of the function - is always handled
 in the bf(ksh)-compatible manner.)
 )
 pindex(KSH_GLOB)
-item(tt(KSH_GLOB))(
+item(tt(KSH_GLOB) <K>)(
 In pattern matching, the interpretation of parentheses is affected by
 a preceding `tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)'.
 See noderef(Filename Generation).
@@ -481,32 +614,53 @@ pindex(KSH_OPTION_PRINT)
 cindex(option printing, ksh style)
 cindex(option printing style, ksh)
 cindex(ksh, option printing style)
-item(tt(KSH_OPTION_PRINT))(
-Alters the way options settings are printed.
+item(tt(KSH_OPTION_PRINT) <K>)(
+Alters the way options settings are printed: instead of separate lists of
+set and unset options, all options are shown, marked `on' if
+they are in the non-default state, `off' otherwise.
 )
 pindex(LIST_AMBIGUOUS)
 cindex(ambiguous completion)
 cindex(completion, ambiguous)
-item(tt(LIST_AMBIGUOUS))(
-If this option is set, completions are shown only if the completions
-don't have a unambiguous prefix or suffix that could be inserted in
-the command line.
+item(tt(LIST_AMBIGUOUS) <D>)(
+This option works when tt(AUTO_LIST) or tt(BASH_AUTO_LIST) is also
+set.  If there is an unambiguous prefix to insert on the command line,
+that is done without a completion list being displayed; in other
+words, auto-listing behaviour only takes place when nothing would be
+inserted.  In the case of tt(BASH_AUTO_LIST), this means that the list
+will be delayed to the third call of the function.
 )
 pindex(LIST_BEEP)
 cindex(beep, ambiguous completion)
 cindex(completion, beep on ambiguous)
-item(tt(LIST_BEEP))(
-Beep on an ambiguous completion.
+item(tt(LIST_BEEP) <D>)(
+Beep on an ambiguous completion.  More accurately, this forces the
+completion widgets to return status 1 on an ambiguous completion, which
+causes the shell to beep if the option tt(BEEP) is also set; this may
+be modified if completion is called from a user-defined widget.
+)
+pindex(LIST_PACKED)
+cindex(completion, listing)
+item(tt(LIST_PACKED))(
+Try to make the completion list smaller (occupying less lines) by
+printing the matches in columns with different widths.
+)
+pindex(LIST_ROWS_FIRST)
+cindex(completion, listing order)
+item(tt(LIST_ROWS_FIRST))(
+Lay out the matches in completion lists sorted horizontally, that is,
+the second match is to the right of the first one, not under it as
+usual.
 )
 pindex(LIST_TYPES)
 cindex(marking file types)
 cindex(files, marking type of)
-item(tt(LIST_TYPES) (tt(-X)))(
+item(tt(LIST_TYPES) (tt(-X)) <D>)(
 When listing files that are possible completions, show the
 type of each file with a trailing identifying mark.
 )
 pindex(LOCAL_OPTIONS)
-item(tt(LOCAL_OPTIONS))(
+item(tt(LOCAL_OPTIONS) <K>)(
 If this option is set at the point of return from a shell function,
 all the options (including this one) which were in force upon entry to
 the function are restored.  Otherwise, only this option and the
@@ -514,7 +668,24 @@ tt(XTRACE) and tt(PRINT_EXIT_VALUE) options are restored.  Hence
 if this is explicitly unset by a shell function the other options in
 force at the point of return will remain so.
 A shell function can also guarantee itself a known shell configuration
-with a formulation like `tt(emulate zsh; setopt localoptions)'.
+with a formulation like `tt(emulate -L zsh)'; the tt(-L) activates
+tt(LOCAL_OPTIONS).
+)
+pindex(LOCAL_TRAPS)
+item(tt(LOCAL_TRAPS) <K>)(
+If this option is set when a signal trap is set inside a function, then the
+previous status of the trap for that signal will be restored when the
+function exits.  Note that this option must be set em(prior) to altering the
+trap behaviour in a function; unlike tt(LOCAL_OPTIONS), the value on exit
+from the function is irrelevant.  However, it does not need to be set
+before any global trap for that to be correctly restored by a function.
+For example,
+
+example(unsetopt localtraps
+trap - INT
+fn() { setopt localtraps; trap '' INT; sleep 3; })
+
+will restore normally handling of tt(SIGINT) after the function exits.
 )
 pindex(LOGIN)
 item(tt(LOGIN) (tt(-l), ksh: tt(-l)))(
@@ -529,12 +700,14 @@ List jobs in the long format by default.
 )
 pindex(MAGIC_EQUAL_SUBST)
 item(tt(MAGIC_EQUAL_SUBST))(
-All unquoted arguments of the form `var(identifier)tt(=)var(expression)'
+All unquoted arguments of the form `var(anything)tt(=)var(expression)'
 appearing after the command name have filename expansion (that is,
 where var(expression) has a leading `tt(~)' or `tt(=)') performed on
 var(expression) as if it were a parameter assignment.  The argument is
 not otherwise treated specially; it is passed to the command as a single
-argument, and not used as an actual parameter assignment.
+argument, and not used as an actual parameter assignment.  For example, in
+tt(echo foo=~/bar:~/rod), both occurrences of tt(~) would be replaced.
+Note that this happens anyway with tt(typeset) and similar statements.
 )
 pindex(MAIL_WARNING)
 cindex(mail, warning of reading)
@@ -565,13 +738,13 @@ item(tt(MONITOR) (tt(-m), ksh: tt(-m)))(
 Allow job control.  Set by default in interactive shells.
 )
 pindex(MULTIOS)
-item(tt(MULTIOS))(
+item(tt(MULTIOS) <Z>)(
 Perform implicit bf(tee)s or bf(cat)s when multiple
 redirections are attempted (see noderef(Redirection)).
 )
 pindex(NOMATCH)
 cindex(globbing, no matches)
-item(tt(NOMATCH) (tt(PLUS()3)))(
+item(tt(NOMATCH) (tt(PLUS()3)) <C> <Z>)(
 If a pattern for filename generation has no matches,
 print an error, instead of
 leaving it unchanged in the argument list.
@@ -581,7 +754,7 @@ of an initial `tt(~)' or `tt(=)'.
 pindex(NOTIFY)
 cindex(background jobs, notification)
 cindex(notification of background jobs)
-item(tt(NOTIFY) (tt(-5), ksh: tt(-b)))(
+item(tt(NOTIFY) (tt(-5), ksh: tt(-b)) <Z>)(
 Report the status of background jobs immediately, rather than
 waiting until just before printing a prompt.
 )
@@ -613,11 +786,10 @@ Thus if `tt(/usr/local/bin)' is in the user's path, and he types
 (assuming it exists).
 Commands explicitly beginning with `tt(/)', `tt(./)' or `tt(../)'
 are not subject to the path search.
-This also applies to the tt(.) builtin,
-and searches for modules performed by the tt(zmodload) builtin.
+This also applies to the tt(.) builtin.
 )
 pindex(POSIX_BUILTINS)
-item(tt(POSIX_BUILTINS))(
+item(tt(POSIX_BUILTINS) <K> <S>)(
 When this option is set the tt(command) builtin can be used to execute
 shell builtin commands.  Parameter assignments specified before shell
 functions and special builtins are kept after the command completes unless
@@ -643,7 +815,7 @@ tt(trap) and
 tt(unset).
 )
 pindex(PRINT_EIGHT_BIT)
-cindex(exit status, printing)
+cindex(eight bit characters, printing)
 item(tt(PRINT_EIGHT_BIT))(
 Print eight bit characters literally in completion lists, etc.
 This option is not necessary if your system correctly returns the
@@ -672,25 +844,26 @@ option.
 )
 pindex(PROMPT_BANG)
 cindex(prompt, ! expansion)
-item(tt(PROMPT_BANG))(
+item(tt(PROMPT_BANG) <K>)(
 If set, `tt(!)' is treated specially in prompt expansion.
 See noderef(Prompt Expansion).
 )
 pindex(PROMPT_CR)
 cindex(prompt, with CR)
-item(tt(PROMPT_CR) (tt(PLUS()V)))(
+item(tt(PROMPT_CR) (tt(PLUS()V)) <D>)(
 Print a carriage return just before printing
-a prompt in the line editor.
+a prompt in the line editor.  This is on by default as multi-line editing
+is only possible if the editor knows where the start of the line appears.
 )
 pindex(PROMPT_PERCENT)
 cindex(prompt, % expansion)
-item(tt(PROMPT_PERCENT))(
+item(tt(PROMPT_PERCENT) <C> <Z>)(
 If set, `tt(%)' is treated specially in prompt expansion.
 See noderef(Prompt Expansion).
 )
 pindex(PROMPT_SUBST)
 cindex(prompt, parameter expansion)
-item(tt(PROMPT_SUBST))(
+item(tt(PROMPT_SUBST) <K>)(
 If set, em(parameter expansion), em(command substitution) and
 em(arithmetic expansion) are performed in prompts.
 )
@@ -734,12 +907,15 @@ within singly quoted strings.
 )
 pindex(RCS)
 cindex(startup files, sourcing)
-item(tt(RCS) (tt(PLUS()f)))(
+item(tt(RCS) (tt(PLUS()f)) <D>)(
 After tt(/etc/zshenv) is sourced on startup, source the
 tt(.zshenv), tt(/etc/zprofile), tt(.zprofile),
 tt(/etc/zshrc), tt(.zshrc), tt(/etc/zlogin), tt(.zlogin), and tt(.zlogout)
 files, as described in noderef(Files).
-If this option is unset, only the tt(/etc/zshenv) file is sourced.
+If this option is unset, the tt(/etc/zshenv) file is still sourced, but any
+of the others will not be; it can be set at any time to prevent the
+remaining startup files after the currently executing one from
+being sourced.
 )
 pindex(REC_EXACT)
 cindex(completion, exact matches)
@@ -758,7 +934,7 @@ noderef(Restricted Shell).
 pindex(RM_STAR_SILENT)
 cindex(rm *, querying before)
 cindex(querying before rm *)
-item(tt(RM_STAR_SILENT) (tt(-H)))(
+item(tt(RM_STAR_SILENT) (tt(-H)) <K> <S>)(
 Do not query the user before executing `tt(rm *)' or `tt(rm path/*)'.
 )
 pindex(RM_STAR_WAIT)
@@ -771,10 +947,33 @@ This avoids the problem of reflexively answering `yes' to the query
 when one didn't really mean it.  The wait and query can always be
 avoided by expanding the `tt(*)' in ZLE (with tab).
 )
+pindex(SHARE_HISTORY)
+cindex(share history)
+cindex(history, sharing)
+item(tt(SHARE_HISTORY) <K>)(
+
+This option both imports new commands from the history file, and also
+causes your typed commands to be appended to the history file (the
+latter is like specifying tt(INC_APPEND_HISTORY)).
+The history lines are also output with timestamps ala
+tt(EXTENDED_HISTORY) (which makes it easier to find the spot where
+we left off reading the file after it gets re-written).
+
+By default, history movement commands visit the imported lines as
+well as the local lines, but you can toggle this on and off with the
+set-local-history zle binding.  It is also possible to create a zle
+widget that will make some commands ignore imported commands, and
+some include them.
+
+If you find that you want more control over when commands
+get imported, you may wish to turn tt(SHARE_HISTORY) off,
+tt(INC_APPEND_HISTORY) on, and then manually import
+commands whenever you need them using `tt(fc -RI)'.
+)
 pindex(SH_FILE_EXPANSION)
 cindex(sh, expansion style)
 cindex(expansion style, sh)
-item(tt(SH_FILE_EXPANSION))(
+item(tt(SH_FILE_EXPANSION) <K> <S>)(
 Perform filename expansion (e.g., ~ expansion) em(before)
 parameter expansion, command substitution, arithmetic expansion
 and brace expansion.
@@ -785,7 +984,7 @@ brace expansion, so things like `tt(~$USERNAME)' and
 pindex(SH_GLOB)
 cindex(sh, globbing style)
 cindex(globbing style, sh)
-item(tt(SH_GLOB))(
+item(tt(SH_GLOB) <K> <S>)(
 Disables the special meaning of `tt(LPAR())', `tt(|)', `tt(RPAR())'
 and 'tt(<)' for globbing the result of parameter and command substitutions,
 and in some other places where
@@ -805,27 +1004,39 @@ Note that setting or unsetting this option on the command line does not
 necessarily affect the state the option will have while the shell is
 running - that is purely an indicator of whether on not commands are
 em(actually) being read from standard input.
-The value of this option cannot be changed anywhere other than the command line.
+The value of this option cannot be changed anywhere other 
+than the command line.
+)
+pindex(SH_NULLCMD)
+vindex(NULLCMD, ignoring)
+vindex(READNULLCMD, ignoring)
+cindex(sh, redirections with no command)
+cindex(ksh, redirections with no command)
+cindex(redirections with no command, sh)
+cindex(redirections with no command, ksh)
+item(tt(SH_NULLCMD) <K> <S>)(
+Do not use the values of tt(NULLCMD) and tt(READNULLCMD) 
+when doing redirections, use `tt(:)' instead (see noderef(Redirection)).
 )
 pindex(SH_OPTION_LETTERS)
 cindex(sh, single letter options style)
 cindex(ksh, single letter options style)
 cindex(single letter options, ksh style)
 cindex(options, single letter, ksh style)
-item(tt(SH_OPTION_LETTERS))(
+item(tt(SH_OPTION_LETTERS) <K> <S>)(
 If this option is set the shell tries to interpret single letter options
 (which are used with tt(set) and tt(setopt)) like bf(ksh) does.
 This also affects the value of the tt(-) special parameter.
 )
 pindex(SHORT_LOOPS)
-item(tt(SHORT_LOOPS))(
+item(tt(SHORT_LOOPS) <C> <Z>)(
 Allow the short forms of tt(for), tt(select),
 tt(if), and tt(function) constructs.
 )
 pindex(SH_WORD_SPLIT)
 cindex(field splitting, sh style)
 cindex(sh, field splitting style)
-item(tt(SH_WORD_SPLIT) (tt(-y)))(
+item(tt(SH_WORD_SPLIT) (tt(-y)) <K> <S>)(
 Causes field splitting to be performed on unquoted parameter expansions.
 Note that this option has nothing to do with word splitting.
 (See noderef(Parameter Expansion).)
@@ -841,7 +1052,7 @@ The value of this option cannot be changed anywhere other than the command line.
 )
 pindex(SINGLE_LINE_ZLE)
 cindex(editor, single line mode)
-item(tt(SINGLE_LINE_ZLE) (tt(-M)))(
+item(tt(SINGLE_LINE_ZLE) (tt(-M)) <K>)(
 Use single-line command line editing instead of multi-line.
 )
 pindex(SUN_KEYBOARD_HACK)
@@ -856,7 +1067,7 @@ too small, and the backquote key lies annoyingly close to it.
 pindex(UNSET)
 cindex(parameters, substituting unset)
 cindex(unset parameters, substituting)
-item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)))(
+item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)) <K> <S> <Z>)(
 Treat unset parameters as if they were empty when substituting.
 Otherwise they are treated as an error.
 )
@@ -876,7 +1087,8 @@ pindex(ZLE)
 cindex(editor, enabling)
 cindex(enabling the editor)
 item(tt(ZLE) (tt(-Z)))(
-Use the zsh line editor.
+Use the zsh line editor.  Set by default in interactive shells connected to
+a terminal.
 )
 enditem()
 texinode(Option Aliases)(Single Letter Options)(Description of Options)(Options)
@@ -1032,6 +1244,7 @@ endsitem()
 subsect(Also note)
 startsitem()
 sitem(tt(-A))(Used by tt(set) for setting arrays)
+sitem(tt(-b))(Used on the command line to specify end of option processing)
 sitem(tt(-c))(Used on the command line to specify a single command)
 sitem(tt(-m))(Used by tt(setopt) for pattern-matching option setting)
 sitem(tt(-o))(Used in all places to allow use of long option names)
diff --git a/Etc/MACHINES b/Etc/MACHINES
index 303508a93..7b602d122 100644
--- a/Etc/MACHINES
+++ b/Etc/MACHINES
@@ -1,3 +1,4 @@
+
 -----------------------------
 ZSH ON SPECIFIC ARCHITECTURES
 -----------------------------
@@ -17,6 +18,10 @@ The format of entries is thus:
 Machines
 --------
 
+Apple/NeXT OpenStep 4.2 for i386.
+	Reported to work at least with gcc 2.8.1 and gawk 2.15 patchlevel
+	6, but not with the bundled cc 2.7.2.1 and awk.
+
 Cray: Unicos (C90 and T90)
 	Should build `out-of-the-box'.
 
@@ -38,22 +43,54 @@ DEC: OSF/1 1.2, 1.3, 2.0, 3.*, DEC Unix 4.* (Alpha)
 	This problem is not related to zsh.  If you have such problems,
 	remove the bogus strip and use /bin/strip instead.
 
-FreeBSD: FreeBSD 2.2.7 [3.1.4]
-	Should build `out-of-the-box'.
+        On Digital UNIX 4.0, compilation with gcc and with --enable-dynamic
+        apparently needs configuring with explicit flags when compiling
+        with debugging enabled:
+          DLLD=gcc LDFLAGS='-g -rpath <path-to-.so-files>' ./configure ...
 
-HP: HP-UX 9, 10.20
+FreeBSD: FreeBSD 2.2.7, 3.x, 4.x
+	Should build `out-of-the-box'.  On FreeBSD 2.2, dynamic	loading
+	does not work, but it does with 3.x and 4.x.
+
+HP: HP-UX 9, 10.20, 11.0
 	Should build `out-of-the-box'.
 
-IBM: AIX
+	Problems with dynamic loading have been reported under 11, but
+	this should compile using the standard dlopen() function set
+	(rather than the 10.20 shl_load() function set).  More details of
+	any difficulties would be appreciated.
+
+IBM: AIX 3.2, 4.1
+	Should build `out-of-the-box', but --enable-zsh-mem will not work.
+
+	On 3.2, for 64-bit integer support you need to compile with gcc, as
+	the native compiler does not support ANSI simulataneously with
+	`long long'.  On 4.1, there appear to be problems using
+	--enable-dynamic (the default) with gcc (version was 2.7.2.3) in
+	4.1, though native cc works. More information about this problem
+	would be appreciated.
+
+Linux: Linux (i[345]86,various Pentia,AMD K6/2)
 	Should build `out-of-the-box'.
 
-Linux: Linux (i386) [3.1.4]
 	If you are using an early minor version of libc 5, then a bug
 	in the auto-configuration process may cause zsh to think that
 	your system doesn't support the lstat function.  If the configure
 	process reports that there is no lstat, edit config.h and change
 	HAVE_LSTAT to 1.  libc-5.2.18 or later does not have this problem.
 
+	Various problems have been reported when using optimisation
+	with the experimental GNU compiler, egcs.  In particular,
+	on Linux Alpha with egcs 1.0.3a and 1.1.1 using -O1 or greater,
+	the completion code is not correctly compiled.
+
+	Some versions of glibc2 have a conflict with <asm/resource.h>
+	which causes a redefinition warning on RLIM_INFINITY.  This
+	causes configure to decide that <sys/resource.h> is not present,
+	which can cause compilation errors in zsh's rlimit code.  The
+	best solution is to edit config.h after running configure and
+	#define HAS_SYS_RESOURCE_H.
+
 NetBSD: NetBSD 1.*
 	Should build `out-of-the-box'.
 
@@ -61,18 +98,34 @@ Next: NextStep 3.*
 	Should build `out-of-the-box', but the zsh malloc routines are
 	not recommended.
 
-Reliant: Reliant UNIX
+OpenBSD: OpenBSD 2.6
 	Should build `out-of-the-box'.
 
-Reliant: SINIX
-	Should build `out-of-the-box'.	There is a bad combination of
-	static and shared libraries that prevents the use of dynamic
-	linking; configure now detects this and will disable dynamic
-	linking even if you requested it.
-
-SGI: IRIX 5.1.1.1, 5.2, 5.3, 6.2, 6.3
+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
+       and CDS/CDS++ compiler.
+
+SIEMENS: SINIX
+       MX (Intel) plattform: SINIX-L/M 5.41
+       Builds out-of-the-box with EGCS. Neither dynamic loading nor
+       64-bit integers are suported. Native compiler was not tried
+       mostly because GCC/EGCS builds out-of-the-box as well. If you 
+       succeed with native compiler, send a patch for this file
+       to zsh-workers.
+
+       RM (MIPS) plattform: SINIX-N/Y 5.42
+       Should build out-of-the-box but it was not tested. Neither
+       dynamic loading nor 64-bit integers are suported.
+       Note, that this version is obsolete and users are expected to 
+       update to Reliant UNIX.
+
+SGI: IRIX 5.1.1.1, 5.2, 5.3, 6.2, 6.3, 6.5
 	Should build `out-of-the-box'.
 
+        On 6.5.2, zsh malloc routines are reported not to work; also
+        full optimization (cc -O3 -OPT:Olimit=0) causes problems.
+
 Sun: SunOS 4.1.*
 	Under 4.1.3 if yellow pages is used, username completion may cause
 	segmentation violation.  This is a bug in the shared library not
@@ -92,3 +145,9 @@ Sun: Solaris 2.*
 	To avoid this, make sure you compile zsh without any reference
 	to /usr/ucblib in your LD_LIBRARY_PATH.  You can easily do this
 	by just unsetting LD_LIBRARY_PATH before building zsh.
+
+	Problems have been reported using --enable-lfs (the default) to
+	enable large file system and integer support on Solaris 2 with gcc.
+	Apparently upgrading to gcc version 2.95.2 fixes this.  If this
+	is not feasible, configure with --disable-lfs.  We would be
+	grateful for more detailed information.
diff --git a/Src/builtin.c b/Src/builtin.c
index f18e956e8..79648561e 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1850,7 +1850,8 @@ bin_typeset(char *name, char **argv, char *ops, int func)
 	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) {
diff --git a/Src/options.c b/Src/options.c
index 745a6627c..c68d58986 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -38,22 +38,13 @@ int emulation;
 /* the options; e.g. if opts[SHGLOB] != 0, SH_GLOB is turned on */
  
 /**/
-char opts[OPT_SIZE];
+mod_export char opts[OPT_SIZE];
  
 /* Option name hash table */
 
 /**/
-HashTable optiontab;
+mod_export HashTable optiontab;
  
-typedef struct optname *Optname;
-
-struct optname {
-    HashNode next;		/* next in hash chain */
-    char *nam;			/* hash data */
-    int flags;
-    int optno;			/* option number */
-};
-
 /* The canonical option name table */
 
 #define OPT_CSH		EMULATE_CSH
@@ -73,12 +64,16 @@ struct optname {
 
 #define defset(X) (!!((X)->flags & emulation))
 
+/*
+ * Note that option names should usually be fewer than 20 characters long
+ * to avoid formatting problems.
+ */
 static struct optname optns[] = {
-{NULL, "allexport",	      0,			 ALLEXPORT},
+{NULL, "allexport",	      OPT_EMULATE,		 ALLEXPORT},
 {NULL, "alwayslastprompt",    OPT_ALL,			 ALWAYSLASTPROMPT},
 {NULL, "alwaystoend",	      0,			 ALWAYSTOEND},
 {NULL, "appendhistory",	      OPT_ALL,			 APPENDHISTORY},
-{NULL, "autocd",	      0,			 AUTOCD},
+{NULL, "autocd",	      OPT_EMULATE,		 AUTOCD},
 {NULL, "autolist",	      OPT_ALL,			 AUTOLIST},
 {NULL, "automenu",	      OPT_ALL,			 AUTOMENU},
 {NULL, "autonamedirs",	      0,			 AUTONAMEDIRS},
@@ -88,15 +83,18 @@ static struct optname optns[] = {
 {NULL, "autoremoveslash",     OPT_ALL,			 AUTOREMOVESLASH},
 {NULL, "autoresume",	      0,			 AUTORESUME},
 {NULL, "badpattern",	      OPT_EMULATE|OPT_NONBOURNE, BADPATTERN},
-{NULL, "banghist",	      OPT_EMULATE|OPT_NONBOURNE, BANGHIST},
+{NULL, "banghist",	      OPT_NONBOURNE,		 BANGHIST},
 {NULL, "bareglobqual",        OPT_EMULATE|OPT_ZSH,       BAREGLOBQUAL},
+{NULL, "bashautolist",	      0,                         BASHAUTOLIST},
 {NULL, "beep",		      OPT_ALL,			 BEEP},
 {NULL, "bgnice",	      OPT_EMULATE|OPT_NONBOURNE, BGNICE},
-{NULL, "braceccl",	      0,			 BRACECCL},
+{NULL, "braceccl",	      OPT_EMULATE,		 BRACECCL},
 {NULL, "bsdecho",	      OPT_EMULATE|OPT_SH,	 BSDECHO},
-{NULL, "cdablevars",	      0,			 CDABLEVARS},
-{NULL, "chaselinks",	      0,			 CHASELINKS},
-{NULL, "clobber",	      OPT_ALL,			 CLOBBER},
+{NULL, "cdablevars",	      OPT_EMULATE,		 CDABLEVARS},
+{NULL, "chasedots",	      OPT_EMULATE,		 CHASEDOTS},
+{NULL, "chaselinks",	      OPT_EMULATE,		 CHASELINKS},
+{NULL, "checkjobs",	      OPT_EMULATE|OPT_ZSH,	 CHECKJOBS},
+{NULL, "clobber",	      OPT_EMULATE|OPT_ALL,	 CLOBBER},
 {NULL, "completealiases",     0,			 COMPLETEALIASES},
 {NULL, "completeinword",      0,			 COMPLETEINWORD},
 {NULL, "correct",	      0,			 CORRECT},
@@ -104,46 +102,57 @@ static struct optname optns[] = {
 {NULL, "cshjunkiehistory",    OPT_EMULATE|OPT_CSH,	 CSHJUNKIEHISTORY},
 {NULL, "cshjunkieloops",      OPT_EMULATE|OPT_CSH,	 CSHJUNKIELOOPS},
 {NULL, "cshjunkiequotes",     OPT_EMULATE|OPT_CSH,	 CSHJUNKIEQUOTES},
+{NULL, "cshnullcmd",	      OPT_EMULATE|OPT_CSH,	 CSHNULLCMD},
 {NULL, "cshnullglob",	      OPT_EMULATE|OPT_CSH,	 CSHNULLGLOB},
 {NULL, "equals",	      OPT_EMULATE|OPT_ZSH,	 EQUALS},
-{NULL, "errexit",	      0,			 ERREXIT},
+{NULL, "errexit",	      OPT_EMULATE,		 ERREXIT},
 {NULL, "exec",		      OPT_ALL,			 EXECOPT},
-{NULL, "extendedglob",	      0,			 EXTENDEDGLOB},
-{NULL, "extendedhistory",     OPT_EMULATE|OPT_CSH,	 EXTENDEDHISTORY},
+{NULL, "extendedglob",	      OPT_EMULATE,		 EXTENDEDGLOB},
+{NULL, "extendedhistory",     OPT_CSH,			 EXTENDEDHISTORY},
 {NULL, "flowcontrol",	      OPT_ALL,			 FLOWCONTROL},
 {NULL, "functionargzero",     OPT_EMULATE|OPT_NONBOURNE, FUNCTIONARGZERO},
-{NULL, "glob",		      OPT_ALL,			 GLOBOPT},
+{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},
-{NULL, "globdots",	      0,			 GLOBDOTS},
+{NULL, "globdots",	      OPT_EMULATE,		 GLOBDOTS},
 {NULL, "globsubst",	      OPT_EMULATE|OPT_NONZSH,	 GLOBSUBST},
 {NULL, "hashcmds",	      OPT_ALL,			 HASHCMDS},
 {NULL, "hashdirs",	      OPT_ALL,			 HASHDIRS},
 {NULL, "hashlistall",	      OPT_ALL,			 HASHLISTALL},
 {NULL, "histallowclobber",    0,			 HISTALLOWCLOBBER},
 {NULL, "histbeep",	      OPT_ALL,			 HISTBEEP},
+{NULL, "histexpiredupsfirst", 0,			 HISTEXPIREDUPSFIRST},
+{NULL, "histfindnodups",      0,			 HISTFINDNODUPS},
+{NULL, "histignorealldups",   0,			 HISTIGNOREALLDUPS},
 {NULL, "histignoredups",      0,			 HISTIGNOREDUPS},
 {NULL, "histignorespace",     0,			 HISTIGNORESPACE},
 {NULL, "histnofunctions",     0,			 HISTNOFUNCTIONS},
 {NULL, "histnostore",	      0,			 HISTNOSTORE},
 {NULL, "histreduceblanks",    0,			 HISTREDUCEBLANKS},
+{NULL, "histsavenodups",      0,			 HISTSAVENODUPS},
 {NULL, "histverify",	      0,			 HISTVERIFY},
 {NULL, "hup",		      OPT_EMULATE|OPT_ZSH,	 HUP},
 {NULL, "ignorebraces",	      OPT_EMULATE|OPT_SH,	 IGNOREBRACES},
 {NULL, "ignoreeof",	      0,			 IGNOREEOF},
+{NULL, "incappendhistory",    0,			 INCAPPENDHISTORY},
 {NULL, "interactive",	      OPT_SPECIAL,		 INTERACTIVE},
-{NULL, "interactivecomments", OPT_EMULATE|OPT_BOURNE,	 INTERACTIVECOMMENTS},
+{NULL, "interactivecomments", OPT_BOURNE,		 INTERACTIVECOMMENTS},
 {NULL, "ksharrays",	      OPT_EMULATE|OPT_BOURNE,	 KSHARRAYS},
 {NULL, "kshautoload",	      OPT_EMULATE|OPT_BOURNE,	 KSHAUTOLOAD},
 {NULL, "kshglob",             OPT_EMULATE|OPT_KSH,       KSHGLOB},
 {NULL, "kshoptionprint",      OPT_EMULATE|OPT_KSH,	 KSHOPTIONPRINT},
 {NULL, "listambiguous",	      OPT_ALL,			 LISTAMBIGUOUS},
 {NULL, "listbeep",	      OPT_ALL,			 LISTBEEP},
+{NULL, "listpacked",	      0,			 LISTPACKED},
+{NULL, "listrowsfirst",	      0,			 LISTROWSFIRST},
 {NULL, "listtypes",	      OPT_ALL,			 LISTTYPES},
 {NULL, "localoptions",	      OPT_EMULATE|OPT_KSH,	 LOCALOPTIONS},
+{NULL, "localtraps",	      OPT_EMULATE|OPT_KSH,	 LOCALTRAPS},
 {NULL, "login",		      OPT_SPECIAL,		 LOGINSHELL},
 {NULL, "longlistjobs",	      0,			 LONGLISTJOBS},
-{NULL, "magicequalsubst",     0,			 MAGICEQUALSUBST},
+{NULL, "magicequalsubst",     OPT_EMULATE,		 MAGICEQUALSUBST},
 {NULL, "mailwarning",	      0,			 MAILWARNING},
 {NULL, "markdirs",	      0,			 MARKDIRS},
 {NULL, "menucomplete",	      0,			 MENUCOMPLETE},
@@ -152,33 +161,35 @@ static struct optname optns[] = {
 {NULL, "nomatch",	      OPT_EMULATE|OPT_NONBOURNE, NOMATCH},
 {NULL, "notify",	      OPT_ZSH,			 NOTIFY},
 {NULL, "nullglob",	      OPT_EMULATE,		 NULLGLOB},
-{NULL, "numericglobsort",     0,			 NUMERICGLOBSORT},
+{NULL, "numericglobsort",     OPT_EMULATE,		 NUMERICGLOBSORT},
 {NULL, "overstrike",	      0,			 OVERSTRIKE},
-{NULL, "pathdirs",	      0,			 PATHDIRS},
+{NULL, "pathdirs",	      OPT_EMULATE,		 PATHDIRS},
 {NULL, "posixbuiltins",	      OPT_EMULATE|OPT_BOURNE,	 POSIXBUILTINS},
 {NULL, "printeightbit",       0,                         PRINTEIGHTBIT},
 {NULL, "printexitvalue",      0,			 PRINTEXITVALUE},
 {NULL, "privileged",	      OPT_SPECIAL,		 PRIVILEGED},
-{NULL, "promptbang",	      OPT_EMULATE|OPT_KSH,	 PROMPTBANG},
+{NULL, "promptbang",	      OPT_KSH,			 PROMPTBANG},
 {NULL, "promptcr",	      OPT_ALL,			 PROMPTCR},
-{NULL, "promptpercent",	      OPT_EMULATE|OPT_NONBOURNE, PROMPTPERCENT},
-{NULL, "promptsubst",	      OPT_EMULATE|OPT_KSH,	 PROMPTSUBST},
-{NULL, "pushdignoredups",     0,			 PUSHDIGNOREDUPS},
-{NULL, "pushdminus",	      0,			 PUSHDMINUS},
+{NULL, "promptpercent",	      OPT_NONBOURNE,		 PROMPTPERCENT},
+{NULL, "promptsubst",	      OPT_KSH,			 PROMPTSUBST},
+{NULL, "pushdignoredups",     OPT_EMULATE,		 PUSHDIGNOREDUPS},
+{NULL, "pushdminus",	      OPT_EMULATE,		 PUSHDMINUS},
 {NULL, "pushdsilent",	      0,			 PUSHDSILENT},
-{NULL, "pushdtohome",	      0,			 PUSHDTOHOME},
-{NULL, "rcexpandparam",	      0,			 RCEXPANDPARAM},
-{NULL, "rcquotes",	      0,			 RCQUOTES},
+{NULL, "pushdtohome",	      OPT_EMULATE,		 PUSHDTOHOME},
+{NULL, "rcexpandparam",	      OPT_EMULATE,		 RCEXPANDPARAM},
+{NULL, "rcquotes",	      OPT_EMULATE,		 RCQUOTES},
 {NULL, "rcs",		      OPT_ALL,			 RCS},
 {NULL, "recexact",	      0,			 RECEXACT},
 {NULL, "restricted",	      OPT_SPECIAL,		 RESTRICTED},
 {NULL, "rmstarsilent",	      OPT_BOURNE,		 RMSTARSILENT},
 {NULL, "rmstarwait",	      0,			 RMSTARWAIT},
+{NULL, "sharehistory",	      OPT_KSH,			 SHAREHISTORY},
 {NULL, "shfileexpansion",     OPT_EMULATE|OPT_BOURNE,	 SHFILEEXPANSION},
 {NULL, "shglob",	      OPT_EMULATE|OPT_BOURNE,	 SHGLOB},
 {NULL, "shinstdin",	      OPT_SPECIAL,		 SHINSTDIN},
+{NULL, "shnullcmd",           OPT_EMULATE|OPT_BOURNE,	 SHNULLCMD},
 {NULL, "shoptionletters",     OPT_EMULATE|OPT_BOURNE,	 SHOPTIONLETTERS},
-{NULL, "shortloops",	      OPT_ALL,			 SHORTLOOPS},
+{NULL, "shortloops",	      OPT_EMULATE|OPT_NONBOURNE, SHORTLOOPS},
 {NULL, "shwordsplit",	      OPT_EMULATE|OPT_BOURNE,	 SHWORDSPLIT},
 {NULL, "singlecommand",	      OPT_SPECIAL,		 SINGLECOMMAND},
 {NULL, "singlelinezle",	      OPT_KSH,			 SINGLELINEZLE},
@@ -227,7 +238,7 @@ static short zshletters[LAST_OPT - FIRST_OPT + 1] = {
     /* > */  0,
     /* ? */  0,
     /* @ */  0,
-    /* A */  0,
+    /* A */  0,			/* use with set for arrays */
     /* B */ -BEEP,
     /* C */ -CLOBBER,
     /* D */  PUSHDTOHOME,
@@ -260,9 +271,9 @@ static short zshletters[LAST_OPT - FIRST_OPT + 1] = {
     /* _ */  0,
     /* ` */  0,
     /* a */  ALLEXPORT,
-    /* b */  0,
-    /* c */  0,
-    /* d */  0,
+    /* b */  0,			/* in non-Bourne shells, end of options */
+    /* c */  0,			/* command follows */
+    /* d */ -GLOBALRCS,
     /* e */  ERREXIT,
     /* f */ -RCS,
     /* g */  HISTIGNORESPACE,
@@ -273,7 +284,7 @@ static short zshletters[LAST_OPT - FIRST_OPT + 1] = {
     /* l */  LOGINSHELL,
     /* m */  MONITOR,
     /* n */ -EXECOPT,
-    /* o */  0,
+    /* o */  0,			/* long option name follows */
     /* p */  PRIVILEGED,
     /* q */  0,
     /* r */  RESTRICTED,
@@ -376,9 +387,9 @@ printoptionnode(HashNode hn, int set)
 	optno = -optno;
     if (isset(KSHOPTIONPRINT)) {
 	if (defset(on))
-	    printf("no%-20s%s\n", on->nam, isset(optno) ? "off" : "on");
+	    printf("no%-19s %s\n", on->nam, isset(optno) ? "off" : "on");
 	else
-	    printf("%-22s%s\n", on->nam, isset(optno) ? "on" : "off");
+	    printf("%-21s %s\n", on->nam, isset(optno) ? "on" : "off");
     } else if (set == (isset(optno) ^ defset(on))) {
 	if (set ^ isset(optno))
 	    fputs("no", stdout);
@@ -397,6 +408,7 @@ createoptiontable(void)
     optiontab->hash        = hasher;
     optiontab->emptytable  = NULL;
     optiontab->filltable   = NULL;
+    optiontab->cmpnodes    = strcmp;
     optiontab->addnode     = addhashnode;
     optiontab->getnode     = gethashnode;
     optiontab->getnode2    = gethashnode2;
@@ -520,17 +532,26 @@ bin_setopt(char *nam, char **args, char *ops, int isun)
     } else {
 	/* Globbing option (-m) set. */
 	while (*args) {
-	    Comp com;
+	    Patprog pprog;
+	    char *s, *t;
+
+	    t = s = dupstring(*args);
+	    while (*t)
+		if (*t == '_')
+		    chuck(t);
+		else {
+		    *t = tulower(*t);
+		    t++;
+		}
 
 	    /* Expand the current arg. */
-	    tokenize(*args);
-	    if (!(com = parsereg(*args))) {
-		untokenize(*args);
+	    tokenize(s);
+	    if (!(pprog = patcompile(s, PAT_STATIC, NULL))) {
 		zwarnnam(nam, "bad pattern: %s", *args, 0);
 		continue;
 	    }
 	    /* Loop over expansions. */
-	    scanmatchtable(optiontab, com, 0, OPT_ALIAS, setoption, !isun);
+	    scanmatchtable(optiontab, pprog, 0, OPT_ALIAS, setoption, !isun);
 	    args++;
 	}
     }
@@ -541,7 +562,7 @@ bin_setopt(char *nam, char **args, char *ops, int isun)
 /* Identify an option name */
 
 /**/
-int
+mod_export int
 optlookup(char const *name)
 {
     char *s, *t;
@@ -604,7 +625,7 @@ static char *rparams[] = {
  * from the usual meaning of the option.                            */
 
 /**/
-int
+mod_export int
 dosetopt(int optno, int value, int force)
 {
     if(!optno)
@@ -624,6 +645,8 @@ dosetopt(int optno, int value, int force)
 	}
     } else if(!force && (optno == INTERACTIVE || optno == SHINSTDIN ||
 	    optno == SINGLECOMMAND)) {
+	if (opts[optno] == value)
+	    return 0;
 	/* it is not permitted to change the value of these options */
 	return -1;
     } else if(!force && optno == USEZLE && value) {
@@ -636,6 +659,14 @@ dosetopt(int optno, int value, int force)
 	setuid(getuid());
 	setgid(getgid());
 #endif /* HAVE_SETUID */
+#ifndef JOB_CONTROL
+    } else if(optno == MONITOR && value) {
+	    return -1;
+#endif /* not JOB_CONTROL */
+#ifdef GETPWNAM_FAKED
+    } else if(optno == CDABLEVARS && value) {
+	    return -1;
+#endif /* GETPWNAM_FAKED */
     }
     opts[optno] = value;
     if (optno == BANGHIST || optno == SHINSTDIN)
diff --git a/Src/zsh.h b/Src/zsh.h
index 5c7dc27ad..585e94e59 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1344,6 +1344,7 @@ enum {
     EXTENDEDHISTORY,
     FLOWCONTROL,
     FUNCTIONARGZERO,
+    GLOBALEXPORT,
     GLOBALRCS,
     GLOBOPT,
     GLOBASSIGN,