diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/Modules/zutil.c | 17 |
2 files changed, 16 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog index 8a8666c1d..e70ed9d80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ +2016-01-27 Barton E. Schaefer <schaefer@zsh.org> + + * 37810: Src/Modules/zutil.c: repair handling of backslashes and + of names starting with "+"/":"/"=" in zparseopts option specs + 2016-01-26 Eric Cook <llua@gmx.com> * 37788: Completion/Zsh/Context/_subscript: fix completion of associative array keys -2016-01-26 Barton E. Schaefer <schaefer@brasslantern.com> +2016-01-26 Barton E. Schaefer <schaefer@zsh.org> * 37802: Doc/Zsh/mod_zutil.yo: Clarify zparseopts description. diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index d98028a84..12a4c03e9 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -1745,13 +1745,15 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) for (p = o; *p; p++) { if (*p == '\\' && p[1]) p++; - else if (*p == '+') { - f |= ZOF_MULT; - *p = '\0'; - p++; - break; - } else if (*p == ':' || *p == '=') - break; + else if (p > o) { /* At least one character of option name */ + if (*p == '+') { + f |= ZOF_MULT; + *p = '\0'; + p++; + break; + } else if (*p == ':' || *p == '=') + break; + } } if (*p == ':') { f |= ZOF_ARG; @@ -1789,6 +1791,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) p++; *n++ = *p; } + *n = '\0'; if (get_opt_desc(o)) { zwarnnam(nam, "option defined more than once: %s", o); return 1; |