mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
typeset equivalents: use 'typeset' in error messages (re: 1fbbeaa1
)
When giving an invalid or incompatible option to a typeset option equivalent command (former default alias) such as 'compound' or 'integer', the resulting usage messages are incorrect. Example: $ ksh -c 'compound -T foo=(typeset -a bar[1]=23)' ksh: compound: -T cannot be used with other options Usage: compound [-bflmnprstuxACHS] [-a[[type]]] [-i[base]] [-E[n]] [-F[n]] [-L[n]] [-M[mapping]] [-R[n]] [-X[n]] [-h string] [-T[tname]] [-Z[n]] [name[=value]...] Or: compound -f [name...] Or: compound -m [name=name...] Or: compound -n [name=name...] Or: compound -T [tname[=(type definition)]...] Help: compound [ --help | --man ] 2>&1 The error message is wrong (there were no other options) and some of the listed usages are invalid, like 'compound -f'. Typeset option equivalent commands should just use 'typeset' in all their error messages to avoid confusion. This is done by setting error_info.id to the name of the typeset builtin.
This commit is contained in:
parent
7318afc278
commit
c9ca0ff531
2 changed files with 3 additions and 1 deletions
|
@ -221,7 +221,7 @@ int b_typeset(int argc,register char *argv[],Shbltin_t *context)
|
||||||
else if(argv[0][0] != 't') /* not <t>ypeset */
|
else if(argv[0][0] != 't') /* not <t>ypeset */
|
||||||
{
|
{
|
||||||
char **new_argv = (char **)stakalloc((argc + 2) * sizeof(char*));
|
char **new_argv = (char **)stakalloc((argc + 2) * sizeof(char*));
|
||||||
new_argv[0] = "typeset";
|
error_info.id = new_argv[0] = SYSTYPESET->nvname;
|
||||||
if(argv[0][0] == 'a') /* <a>utoload == typeset -fu */
|
if(argv[0][0] == 'a') /* <a>utoload == typeset -fu */
|
||||||
new_argv[1] = "-fu";
|
new_argv[1] = "-fu";
|
||||||
else if(argv[0][0] == 'c') /* <c>ompound == typeset -C */
|
else if(argv[0][0] == 'c') /* <c>ompound == typeset -C */
|
||||||
|
|
|
@ -1039,6 +1039,8 @@ do case $bltin in
|
||||||
actual=$({ PATH=${bltin%/*}; "${bltin##*/}" --this-option-does-not-exist; } 2>&1) ;;
|
actual=$({ PATH=${bltin%/*}; "${bltin##*/}" --this-option-does-not-exist; } 2>&1) ;;
|
||||||
*/*) err_exit "strange path name in 'builtin' output: $(printf %q "$bltin")"
|
*/*) err_exit "strange path name in 'builtin' output: $(printf %q "$bltin")"
|
||||||
continue ;;
|
continue ;;
|
||||||
|
autoload | compound | float | functions | integer | nameref)
|
||||||
|
bltin=typeset ;&
|
||||||
*) expect="Usage: $bltin "
|
*) expect="Usage: $bltin "
|
||||||
actual=$({ "${bltin}" --this-option-does-not-exist; } 2>&1) ;;
|
actual=$({ "${bltin}" --this-option-does-not-exist; } 2>&1) ;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue