diff options
author | Joshua Krusell <js.shirin@gmail.com> | 2021-02-03 11:33:47 +0000 |
---|---|---|
committer | Peter Stephenson <p.stephenson@samsung.com> | 2021-02-03 11:33:47 +0000 |
commit | 9120d1e841b0813f1c71d55f77c3d18fc8318187 (patch) | |
tree | 3e19f9e06f35b27d342e073344ffc79ac2ddbf79 | |
parent | 93c4cc0d8f1ad92f5f407a50e98d62bdc7d5c1b4 (diff) | |
download | zsh-9120d1e841b0813f1c71d55f77c3d18fc8318187.tar.gz zsh-9120d1e841b0813f1c71d55f77c3d18fc8318187.tar.xz zsh-9120d1e841b0813f1c71d55f77c3d18fc8318187.zip |
47899: Improve error message from zparseopts.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/Modules/zutil.c | 5 | ||||
-rw-r--r-- | Test/V12zparseopts.ztst | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 52ebf9513..d5725d379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-02-03 Joshua Krusell <js.shirin@gmail.com> + + * 47899: Src/Modules/zutil.c, Test/V12zparseopts.ztst: Improved + error message from zparseopts. + 2021-01-20 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> * 47883: Completion/Unix/Command/_awk: support gawk ver.5 diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index 5c96d06c1..c8017d0c0 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -1873,7 +1873,10 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) while (*++o) { if (!(d = sopts[STOUC(*o)])) { if (fail) { - zwarnnam(nam, "bad option: %c", *o); + if (*o != '-') + zwarnnam(nam, "bad option: %c", *o); + else + zwarnnam(nam, "bad option: %s", o); return 1; } o = NULL; diff --git a/Test/V12zparseopts.ztst b/Test/V12zparseopts.ztst index d7fc33f72..c41c49022 100644 --- a/Test/V12zparseopts.ztst +++ b/Test/V12zparseopts.ztst @@ -69,7 +69,7 @@ >ret: 1, optv: , argv: -a -x -z ?(anon):zparseopts:2: bad option: x >ret: 1, optv: , argv: -ax -z -?(anon):zparseopts:2: bad option: - +?(anon):zparseopts:2: bad option: -x >ret: 1, optv: , argv: -a --x -z for 1 in '-a 1 2 3' '1 2 3'; do |