diff options
author | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-10-29 20:13:58 +0000 |
---|---|---|
committer | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-10-29 20:13:58 +0000 |
commit | 52f25ab3d2d81a7c3172a54e3c0824de40b30270 (patch) | |
tree | 0013ad2ed5e90dd6141f6b058c1471ecda043ff4 /Src | |
parent | b0dd9cf2a2dce3cc1b656fa79c8fb3e548a02132 (diff) | |
download | zsh-52f25ab3d2d81a7c3172a54e3c0824de40b30270.tar.gz zsh-52f25ab3d2d81a7c3172a54e3c0824de40b30270.tar.xz zsh-52f25ab3d2d81a7c3172a54e3c0824de40b30270.zip |
Merge of 22780: _arguments -n sets NORMARG to index of first non-option argument (via comparguments -n).
Diffstat (limited to 'Src')
-rw-r--r-- | Src/Zle/computil.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index e56972cee..9ed1e83f3 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -2285,6 +2285,7 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) case 'M': min = 1; max = 1; break; case 'a': min = 0; max = 0; break; case 'W': min = 2; max = 2; break; + case 'n': min = 1; max = 1; break; default: zwarnnam(nam, "invalid option: %s", args[0], 0); return 1; @@ -2579,6 +2580,20 @@ bin_comparguments(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) sethparam(args[2], ret); } return 0; + case 'n': + /* + * This returns the array index of the word where normal + * arguments began. It uses optbeg rather than nargbeg + * (the value used when parsing) because nargbeg is assigned + * to optbeg in the returned value and nargbeg isn't + * used. + * + * -->PLEASE DON'T ASK<-- + * + * Thank you. + */ + setiparam(args[1], (zlong)ca_laststate.optbeg + !isset(KSHARRAYS)); + return 0; } return 1; } |