path: root/Doc
diff options
authordana <dana@dana.is>2021-05-03 18:08:11 -0500
committerdana <dana@dana.is>2021-05-03 18:11:38 -0500
commitc23a0d84b029676832ea0f2eeb0caa8c47d0500d (patch)
tree2d404a5367fb6b02b895a53b017d7aa1ffc0ab6e /Doc
parent2da0d8b52fc90ce82891ae161fe6df89111c5e5c (diff)
48614: getopts: Calculate OPTIND according to POSIX_BUILTINS
Diffstat (limited to 'Doc')
2 files changed, 4 insertions, 2 deletions
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 61dc6986f..022921bfa 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -982,7 +982,8 @@ vindex(OPTARG, use of)
The first option to be examined may be changed by explicitly assigning
to tt(OPTIND). tt(OPTIND) has an initial value of tt(1), and is
normally set to tt(1) upon entry to a shell function and restored
-upon exit (this is disabled by the tt(POSIX_BUILTINS) option). tt(OPTARG)
+upon exit. (The tt(POSIX_BUILTINS) option disables this, and also changes
+the way the value is calculated to match other shells.) tt(OPTARG)
is not reset and retains its value from the most recent call to
tt(getopts). If either of tt(OPTIND) or tt(OPTARG) is explicitly
unset, it remains unset, and the index or option argument is not
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 6e862fae8..546b16b65 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -2249,7 +2249,8 @@ command found in the path.
Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
fashion in that the associated variable tt(OPTIND) is not made
-local to functions.
+local to functions, and its value is calculated differently to match
+other shells.
Moreover, the warning and special exit code from
tt([[ -o )var(non_existent_option)tt( ]]) are suppressed.