diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-10 09:28:43 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-09-10 09:28:43 +0000 |
commit | bc3256997b737f6158e9768dcf5738a7c0fbb454 (patch) | |
tree | 0a2d6b73c8c114649549c6d49145e45ada9fb46e /Src/builtin.c | |
parent | dbdf7e33a17e1f2dfee689190340590979271635 (diff) | |
download | zsh-bc3256997b737f6158e9768dcf5738a7c0fbb454.tar.gz zsh-bc3256997b737f6158e9768dcf5738a7c0fbb454.tar.xz zsh-bc3256997b737f6158e9768dcf5738a7c0fbb454.zip |
zsh-workers/7765
Diffstat (limited to 'Src/builtin.c')
-rw-r--r-- | Src/builtin.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index ed9d01909..9184fd719 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -2936,6 +2936,9 @@ bin_shift(char *name, char **argv, char *ops, int func) return ret; } +/**/ +int optcind; + /* getopts: automagical option handling for shell scripts */ /**/ @@ -2945,7 +2948,6 @@ bin_getopts(char *name, char **argv, char *ops, int func) int lenstr, lenoptstr, quiet, lenoptbuf; char *optstr = unmetafy(*argv++, &lenoptstr), *var = *argv++; char **args = (*argv) ? argv : pparams; - static int optcind = 0; char *str, optbuf[2] = " ", *p, opch; /* zoptind keeps count of the current argument number. The * @@ -2994,8 +2996,8 @@ bin_getopts(char *name, char **argv, char *ops, int func) p = "?"; err: zsfree(zoptarg); + setsparam(var, ztrdup(p)); if(quiet) { - setsparam(var, ztrdup(p)); zoptarg = metafy(optbuf, lenoptbuf, META_DUP); } else { zerr(*p == '?' ? "bad option: -%c" : |