mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
This fixes the following: 1. 'set --posix' now works as an equivalent of 'set -o posix'. 2. The posix option turns off braceexpand and turns on letoctal. Any attempt to override that in a single command such as 'set -o posix +o letoctal' was quietly ignored. This now works as long as the overriding option follows the posix option in the command. 3. The --default option to 'set' now stops the 'posix' option, if set or unset in the same 'set' command, from changing other options. This allows the command output by 'set +o' to correctly restore the current options. src/cmd/ksh93/data/builtins.c: - To make 'set --posix' work, we must explicitly list it in sh_set[] as a supported option so that AST optget(3) recognises it and won't override it with its own default --posix option, which converts the optget(3) string to at POSIX getopt(3) string. This means it will appear as a separate entry in --man output, whether we want it to or not. So we might as well use it as an example to document how --optionname == -o optionname, replacing the original documentation that was part of the '-o' description. src/cmd/ksh93/sh/args.c: sh_argopts(): - Add handling for explitit --posix option in data/builtins.c. - Move SH_POSIX syncing SH_BRACEEXPAND and SH_LETOCTAL from sh_applyopts() into the option parsing loop here. This fixes the bug that letoctal was ignored in 'set -o posix +o letoctal'. - Remember if --default was used in a flag, and do not sync options with SH_POSIX if the flag is set. This makes 'set +o' work. src/cmd/ksh93/include/argnod.h, src/cmd/ksh93/data/msg.c, src/cmd/ksh93/sh/args.c: sh_printopts(): - Do not potentially translate the 'on' and 'off' labels in 'set -o' output. No other shell does, and some scripts parse these. src/cmd/ksh93/sh/init.c: sh_init(): - Turn on SH_LETOCTAL early along with SH_POSIX if the shell was invoked as sh; this makes 'sh -o' and 'sh +o' show expected options (not that anyone does this, but correctness is good). src/cmd/ksh93/include/defs.h, src/cmd/ksh93/include/shell.h: - The state flags were in defs.h and most (but not all) of the shell options were in shell.h. Gather all the shell state and option flag definitions into one place in shell.h for clarity. - Remove unused SH_NOPROFILE and SH_XARGS option flags. src/cmd/ksh93/tests/options.sh: - Add tests for these bugs. src/lib/libast/misc/optget.c: styles[]: - Edit default optget(3) option self-documentation for clarity. Several changed files: - Some SHOPT_PFSH fixes to avoid compiling dead code.
This commit is contained in:
parent
cd1cd9c5da
commit
af5f7acf99
15 changed files with 123 additions and 83 deletions
|
@ -229,29 +229,29 @@ standard error."),
|
|||
static const Help_t styles[] =
|
||||
{
|
||||
C("about"), "-", STYLE_match,
|
||||
Z("List all implementation info."),
|
||||
Z("Show all implementation info."),
|
||||
C("api"), "?api", STYLE_api,
|
||||
Z("List detailed info in program readable form."),
|
||||
Z("Output detailed info in program readable form."),
|
||||
C("help"), "", -1,
|
||||
Z("List detailed help option info."),
|
||||
Z("Show detailed help option info."),
|
||||
C("html"), "?html", STYLE_html,
|
||||
Z("List detailed info in html."),
|
||||
Z("Output detailed info in HTML."),
|
||||
C("keys"), "?keys", STYLE_keys,
|
||||
Z("List the usage translation key strings with C style escapes."),
|
||||
Z("Output usage key strings for translation."),
|
||||
C("long"), "?long", STYLE_long,
|
||||
Z("List long option usage."),
|
||||
Z("Show brief usage with long options."),
|
||||
C("man"), "?man", STYLE_man,
|
||||
Z("List detailed info in displayed man page form."),
|
||||
Z("Show detailed info as a manual page."),
|
||||
C("nroff"), "?nroff", STYLE_nroff,
|
||||
Z("List detailed info in nroff."),
|
||||
Z("Output detailed info in nroff format."),
|
||||
C("options"), "?options", STYLE_options,
|
||||
Z("List short and long option details."),
|
||||
C("posix"), "?posix", STYLE_posix,
|
||||
Z("List posix getopt usage."),
|
||||
Z("Output POSIX-compliant getopt(3) short options string."),
|
||||
C("short"), "?short", STYLE_short,
|
||||
Z("List short option usage."),
|
||||
Z("Show brief usage with short options."),
|
||||
C("usage"), "?usage", STYLE_usage,
|
||||
Z("List the usage string with C style escapes."),
|
||||
Z("Output the full AST optget(3) usage string."),
|
||||
};
|
||||
|
||||
static const List_t help_tail[] =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue