1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Add error message for ambiguous long-form option abbreviation

Before:

  $ set -o hist
  -ksh: set: hist: bad option(s)

After:

  $ set --hist
  -ksh: set: hist: ambiguous option

In ksh 93u+m, there are three options starting with 'hist', so the
abbreviation does not represent a single option. It is useful to
communicate this in the error message.

In addition, "bad option(s)" was changed to "unknown option", the
same message as that given by AST optget(3), for consistency.

src/cmd/ksh93/sh/string.c:
- Make sh_lookopt() return -1 for an ambiguous option. This is
  trivial as there is already an 'amb' variable flagging that up.

src/cmd/ksh93/sh/args.c:
- Use the negative sh_lookopt() return status to decide between
  "unknown option" and "ambiguous option".

src/cmd/ksh93/data/builtins.c: sh_set[]:
- Explain the --option and --nooption forms in addition to the -o
  option and +o option forms.
- Document the long options without their 'no' prefixes (e.g. glob
  instead of noglob) as this simplifies documentation and the
  relation with the short options makes more sense. Those names are
  also how they show up in 'set -o' output and it is better for
  those to match.
- Tweaks.
This commit is contained in:
Martijn Dekker 2022-06-09 22:22:24 +01:00
parent 4f9456d69f
commit 3030197b89
9 changed files with 40 additions and 30 deletions

3
NEWS
View file

@ -14,6 +14,9 @@ Any uppercase BUG_* names are modernish shell bug IDs.
- An interactive shell initialized in POSIX mode now once again has the
preset aliases defined. This amends a change made on 2020-09-11.
- If a long-form shell option name is abbreviated so it matches multiple
options, the error message from ksh or 'set' now reads "ambiguous option".
2022-06-08:
- If -B/--braceexpand is turned on in --posix mode, it now only allows brace