mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 16:50:58 +01:00
19767, 19785: store flags for -z and -k options to autoload allowing the
completion system to be used with ksh_autoload set
This commit is contained in:
parent
8c890ebe7f
commit
ca0deae382
13 changed files with 116 additions and 80 deletions
|
|
@ -1,5 +1,13 @@
|
||||||
2004-04-20 Oliver Kiddle <opk@zsh.org>
|
2004-04-20 Oliver Kiddle <opk@zsh.org>
|
||||||
|
|
||||||
|
* 19767, 19785: Src/builtin.c, Src/exec.c, Src/hashtable.c,
|
||||||
|
Src/zsh.h, Completion/compinit, Completion/compdump,
|
||||||
|
Completion/compinstall, Completion/bashcompinit,
|
||||||
|
Completion/Base/Widget/_next_tags, Completion/Zsh/Type/_functions,
|
||||||
|
Completion/Zsh/Command/_typeset, Doc/Zsh/builtins.yo:
|
||||||
|
store flags for -z and -k options to autoload allowing the
|
||||||
|
completion system to be used with ksh_autoload set
|
||||||
|
|
||||||
* 19800: Test/B02typeset.ztst: reverse sense of `declare +m' test
|
* 19800: Test/B02typeset.ztst: reverse sense of `declare +m' test
|
||||||
|
|
||||||
2004-04-19 Clint Adams <clint@zsh.org>
|
2004-04-19 Clint Adams <clint@zsh.org>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ _next_tags() {
|
||||||
(( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
|
(( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
|
||||||
_tags_level=$#funcstack
|
_tags_level=$#funcstack
|
||||||
[[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
|
[[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
|
||||||
_comp_tags="$_comp_tags $__spec "
|
_comp_tags+=" $__spec "
|
||||||
if [[ "$curtag" = *[^\\]:* ]]; then
|
if [[ "$curtag" = *[^\\]:* ]]; then
|
||||||
zformat -f __descr "${curtag#*:}" "d:$3"
|
zformat -f __descr "${curtag#*:}" "d:$3"
|
||||||
_description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
|
_description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
|
||||||
|
|
@ -64,7 +64,7 @@ _next_tags() {
|
||||||
(( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
|
(( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
|
||||||
_tags_level=$#funcstack
|
_tags_level=$#funcstack
|
||||||
[[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
|
[[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
|
||||||
_comp_tags="$_comp_tags $__spec "
|
_comp_tags+=" $__spec "
|
||||||
if [[ "$curtag" = *[^\\]:* ]]; then
|
if [[ "$curtag" = *[^\\]:* ]]; then
|
||||||
zformat -f __descr "${curtag#*:}" "d:$3"
|
zformat -f __descr "${curtag#*:}" "d:$3"
|
||||||
_description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
|
_description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
|
||||||
|
|
@ -92,7 +92,7 @@ _next_tags() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_next_tags_not="$_next_tags_not $_lastcomp[tags]"
|
_next_tags_not+=" $_lastcomp[tags]"
|
||||||
_next_tags_pfx="$PREFIX"
|
_next_tags_pfx="$PREFIX"
|
||||||
_next_tags_sfx="$SUFFIX"
|
_next_tags_sfx="$SUFFIX"
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ _next_tags() {
|
||||||
compstate[insert]="$ins"
|
compstate[insert]="$ins"
|
||||||
compstate[list]='list force'
|
compstate[list]='list force'
|
||||||
|
|
||||||
compprefuncs=( "$compprefuncs[@]" _next_tags_pre )
|
compprefuncs+=( _next_tags_pre )
|
||||||
}
|
}
|
||||||
|
|
||||||
# Completer, for wrap-around.
|
# Completer, for wrap-around.
|
||||||
|
|
@ -132,9 +132,9 @@ _next_tags_pre() {
|
||||||
return 0
|
return 0
|
||||||
elif [[ ${LBUFFER%${PREFIX}} != ${_next_tags_pre}* ]]; then
|
elif [[ ${LBUFFER%${PREFIX}} != ${_next_tags_pre}* ]]; then
|
||||||
unfunction _all_labels _next_label
|
unfunction _all_labels _next_label
|
||||||
autoload -U _all_labels _next_label
|
autoload -Uz _all_labels _next_label
|
||||||
else
|
else
|
||||||
compprefuncs=( "$compprefuncs[@]" _next_tags_pre )
|
compprefuncs+=( _next_tags_pre )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
#compdef autoload
|
|
||||||
|
|
||||||
local expl
|
|
||||||
|
|
||||||
if (( $words[(I)[-+]*w*] )); then
|
|
||||||
_description files expl 'zwc file'
|
|
||||||
_files "$expl[@]" -g '*.zwc(-.)'
|
|
||||||
else
|
|
||||||
_wanted functions expl 'shell function' compadd - ${^fpath}/*(:t)
|
|
||||||
fi
|
|
||||||
|
|
@ -1,27 +1,31 @@
|
||||||
#compdef declare export integer float local readonly typeset
|
#compdef autoload declare export functions integer float local readonly typeset
|
||||||
|
|
||||||
local expl state line func i use curcontext="$curcontext"
|
local expl state line func i use curcontext="$curcontext"
|
||||||
local -A allargs
|
local fopts="-f -k -z"
|
||||||
|
local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x"
|
||||||
|
local -A allargs opt_args
|
||||||
local -a args
|
local -a args
|
||||||
|
|
||||||
allargs=(
|
allargs=(
|
||||||
A '(-E -F -L -R -T -U -Z -a -f -i -m)-A[specify that arguments refer to associative arrays]'
|
A "($fopts -E -F -L -R -T -U -Z -a -i -m)-A[specify that arguments refer to associative arrays]"
|
||||||
E '(-A -F -L -R -T -U -Z -a -f -i -m)-E[floating point, use engineering notation on output]'
|
E "($fopts -A -F -L -R -T -U -Z -a -i -m)-E[floating point, use engineering notation on output]"
|
||||||
F '(-A -E -L -R -T -U -Z -a -f -i -m)-F[floating point, use fixed point decimal on output]'
|
F "($fopts -A -E -L -R -T -U -Z -a -i -m)-F[floating point, use fixed point decimal on output]"
|
||||||
L '(-A -E -F -f -i)-L+[left justify and remove leading blanks from value]:width'
|
L "($fopts -A -E -F -i)-L+[left justify and remove leading blanks from value]:width"
|
||||||
R '(-A -E -F -f -i)-R+[right justify and fill with leading blanks]:width'
|
R "($fopts -A -E -F -i)-R+[right justify and fill with leading blanks]:width"
|
||||||
T '(-A -E -F -a -f -g -h -i -l -m -t)-T[tie scalar to array]'
|
T "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array]"
|
||||||
U '(-A -E -F -i)-U[keep array values unique and suppress alias expansion for functions]'
|
U '(-A -E -F -i)-U[keep array values unique and suppress alias expansion for functions]'
|
||||||
Uf '(-E -F -i)-U[suppress alias expansion for functions]'
|
Uf '-U[suppress alias expansion for functions]'
|
||||||
Up '(-E -F -i)-U[keep array values unique]'
|
Up '(-E -F -i)-+U[keep array values unique]'
|
||||||
Z '(-A -E -F -f -i)-Z+[right justify and fill with leading zeros]:width'
|
X '+X[immediately autoload function]'
|
||||||
a '(-A -E -F -T -f -i)-a[specify that arguments refer to arrays]'
|
Z "($fopts -A -E -F -i)-Z+[right justify and fill with leading zeros]:width"
|
||||||
f '(-A -E -F -L -R -T -Z -a -g -h -i -l -r -x)-f[specify that arguments refer to functions]'
|
a "($fopts -A -E -F -T -i)-a[specify that arguments refer to arrays]"
|
||||||
g '(-T -f)-+g[do not restrict parameter to local scope]'
|
f "($popts)-f[specify that arguments refer to functions]"
|
||||||
h '(-T -f)-+h[hide specialness of parameter]'
|
g "($fopts -T)-+g[do not restrict parameter to local scope]"
|
||||||
H '(-T -f)-+H[hide value of parameter in listings]'
|
h "($fopts -T)-+h[hide specialness of parameter]"
|
||||||
i '(-A -E -F -T -f)-+i[represent internally as an integer]'
|
H "($fopts -T)-+H[hide value of parameter in listings]"
|
||||||
l '(-T -f)-l[convert the value to lowercase]'
|
i "($fopts -A -E -F -T)-+i[represent internally as an integer]"
|
||||||
|
k "($popts -w -z)-+k[mark function for ksh-style autoloading]"
|
||||||
|
l "($popts -T)-l[convert the value to lowercase]"
|
||||||
m '(-A -E -F -T -i)-m[treat arguments as patterns]'
|
m '(-A -E -F -T -i)-m[treat arguments as patterns]'
|
||||||
p '-p[output parameters in form of calls to typeset]'
|
p '-p[output parameters in form of calls to typeset]'
|
||||||
r '(-f)-+r[mark parameters as readonly]'
|
r '(-f)-+r[mark parameters as readonly]'
|
||||||
|
|
@ -31,15 +35,21 @@ allargs=(
|
||||||
u '-u[convert the value to uppercase or mark function for autoloading]'
|
u '-u[convert the value to uppercase or mark function for autoloading]'
|
||||||
uf '-u[mark function for autoloadling]'
|
uf '-u[mark function for autoloadling]'
|
||||||
up '-u[convert the value to uppercase]'
|
up '-u[convert the value to uppercase]'
|
||||||
x '(-f)-+x[export parameter]'
|
w '(-k -z)-w[specify that arguments refer to files compiled with zcompile]'
|
||||||
|
x "($fopts)-+x[export parameter]"
|
||||||
|
z "($popts -k -w)-+z[mark function for zsh-style autoloading]"
|
||||||
)
|
)
|
||||||
|
|
||||||
use="AEFHLRTUZafghilmprtux"
|
use="AEFHLRTUZafghiklmprtuxz"
|
||||||
|
|
||||||
case ${service} in
|
case ${service} in
|
||||||
|
autoload)
|
||||||
|
use="UXktwz"
|
||||||
|
func=f
|
||||||
|
;;
|
||||||
float) use="EFHghlprtux";;
|
float) use="EFHghlprtux";;
|
||||||
functions)
|
functions)
|
||||||
use="Umtu"
|
use="Ukmtuz"
|
||||||
func=f
|
func=f
|
||||||
;;
|
;;
|
||||||
integer)
|
integer)
|
||||||
|
|
@ -47,28 +57,39 @@ case ${service} in
|
||||||
allargs[i]='-i[specify arithmetic base for output]' \
|
allargs[i]='-i[specify arithmetic base for output]' \
|
||||||
;;
|
;;
|
||||||
readonly) use="${use/r/}" ;;
|
readonly) use="${use/r/}" ;;
|
||||||
local) use="${use/f/}" ;&
|
local) use="${use/[fkz]/}" ;&
|
||||||
export) use="${${use/g/}/x/}" ;;
|
export) use="${${use//[gkz]/}/x/}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[[ -z "${words[(r)-*f*]}" ]] || func=f
|
|
||||||
[[ -z "${words[(r)-*[aA]*]}" ]] || func=p
|
[[ -z "${words[(r)-*[aA]*]}" ]] || func=p
|
||||||
|
[[ -z "${words[(r)-*f*]}" ]] || func=f
|
||||||
|
|
||||||
for ((i=1;i<=$#use;++i)); do
|
for ((i=1;i<=$#use;++i)); do
|
||||||
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
|
args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
|
||||||
done
|
done
|
||||||
|
|
||||||
_arguments -C -s -A "-*" -S "${args[@]}" '*:vars:->vars_eq'
|
_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
|
||||||
|
|
||||||
if [[ "$state" = vars_eq ]]; then
|
if [[ "$state" = vars_eq ]]; then
|
||||||
if [[ $func = f ]]; then
|
if [[ $func = f ]]; then
|
||||||
_functions
|
if (( $+opt_args[-w] ));then
|
||||||
|
_wanted files expl 'zwc file' _files -g '*.zwc(-.)'
|
||||||
|
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
|
||||||
|
_wanted functions expl 'shell function' compadd - ${^fpath}/*(:t)
|
||||||
|
else
|
||||||
|
_functions
|
||||||
|
fi
|
||||||
elif [[ "$PREFIX" = *\=* ]]; then
|
elif [[ "$PREFIX" = *\=* ]]; then
|
||||||
compstate[parameter]="${PREFIX%%\=*}"
|
compstate[parameter]="${PREFIX%%\=*}"
|
||||||
compset -P 1 '*='
|
compset -P 1 '*='
|
||||||
_value
|
_value
|
||||||
elif (( $+opt_args[-a] || $+opt_args[-A] )); then
|
elif (( $+opt_args[-a] || $+opt_args[-A] )); then
|
||||||
_parameters -q
|
_parameters -q
|
||||||
|
elif (( $+opt_args[-T] )); then
|
||||||
|
_arguments \
|
||||||
|
':scalar parameter:_parameters -g "*scalar*" -q -S "="' \
|
||||||
|
':array parameter:_parameters -g "*array*"' \
|
||||||
|
':separator character'
|
||||||
else
|
else
|
||||||
_parameters -q -S '='
|
_parameters -q -S '='
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#compdef functions unfunction
|
#compdef unfunction
|
||||||
|
|
||||||
local expl
|
local expl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,5 +168,5 @@ complete() {
|
||||||
}
|
}
|
||||||
|
|
||||||
unfunction bashcompinit
|
unfunction bashcompinit
|
||||||
autoload -U bashcompinit
|
autoload -Uz bashcompinit
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ zle -lL |
|
||||||
d_complist=yes
|
d_complist=yes
|
||||||
fi
|
fi
|
||||||
print -r - ${_d_line}
|
print -r - ${_d_line}
|
||||||
_d_bks=($_d_bks ${_d_line[3]})
|
_d_bks+=(${_d_line[3]})
|
||||||
fi
|
fi
|
||||||
done >> $_d_file
|
done >> $_d_file
|
||||||
bindkey |
|
bindkey |
|
||||||
|
|
@ -108,7 +108,7 @@ _d_als=(${(o)$(typeset +fm '_*')})
|
||||||
# print them out: about five to a line looks neat
|
# print them out: about five to a line looks neat
|
||||||
|
|
||||||
_i=5
|
_i=5
|
||||||
print -n autoload -U >> $_d_file
|
print -n autoload -Uz >> $_d_file
|
||||||
while (( $#_d_als )); do
|
while (( $#_d_als )); do
|
||||||
if (( ! $+_compautos[$_d_als[1]] )); then
|
if (( ! $+_compautos[$_d_als[1]] )); then
|
||||||
print -n " $_d_als[1]"
|
print -n " $_d_als[1]"
|
||||||
|
|
@ -123,7 +123,7 @@ done >> $_d_file
|
||||||
print >> $_d_file
|
print >> $_d_file
|
||||||
|
|
||||||
for _i in "${(ok@)_compautos}"; do
|
for _i in "${(ok@)_compautos}"; do
|
||||||
print "autoload -U $_compautos[$_i] $_i" >> $_d_file
|
print "autoload -Uz $_compautos[$_i] $_i" >> $_d_file
|
||||||
done
|
done
|
||||||
|
|
||||||
print >> $_d_file
|
print >> $_d_file
|
||||||
|
|
@ -134,4 +134,4 @@ print "_comp_assocs=( ${(q)_comp_assocs} )" >> $_d_file
|
||||||
mv $_d_file ${_d_file%.$HOST.$$}
|
mv $_d_file ${_d_file%.$HOST.$$}
|
||||||
|
|
||||||
unfunction compdump
|
unfunction compdump
|
||||||
autoload -U compdump
|
autoload -Uz compdump
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
# generate matches, but should automatically be loaded
|
# generate matches, but should automatically be loaded
|
||||||
# when they are called. The <options> will be given to the
|
# when they are called. The <options> will be given to the
|
||||||
# autoload builtin when making the function autoloaded. Note
|
# autoload builtin when making the function autoloaded. Note
|
||||||
# that this need not include `-U'.
|
# that this need not include `-U' and `-z'.
|
||||||
#
|
#
|
||||||
# Note that no white space is allowed between the `#' and the rest of
|
# Note that no white space is allowed between the `#' and the rest of
|
||||||
# the string.
|
# the string.
|
||||||
|
|
@ -292,7 +292,7 @@ compdef() {
|
||||||
# and probably do autoloading.
|
# and probably do autoloading.
|
||||||
|
|
||||||
func="$1"
|
func="$1"
|
||||||
[[ -n "$autol" ]] && autoload -U "$func"
|
[[ -n "$autol" ]] && autoload -Uz "$func"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
case "$type" in
|
case "$type" in
|
||||||
|
|
@ -406,7 +406,7 @@ typeset _i_wdirs _i_wfiles
|
||||||
_i_wdirs=()
|
_i_wdirs=()
|
||||||
_i_wfiles=()
|
_i_wfiles=()
|
||||||
|
|
||||||
autoload -U compaudit
|
autoload -Uz compaudit
|
||||||
if [[ -n "$_i_check" ]]; then
|
if [[ -n "$_i_check" ]]; then
|
||||||
typeset _i_q
|
typeset _i_q
|
||||||
if ! eval compaudit; then
|
if ! eval compaudit; then
|
||||||
|
|
@ -433,7 +433,7 @@ if [[ -n "$_i_check" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure compdump is available, even if we aren't going to use it.
|
# Make sure compdump is available, even if we aren't going to use it.
|
||||||
autoload -U compdump compinstall
|
autoload -Uz compdump compinstall
|
||||||
|
|
||||||
# If we have a dump file, load it.
|
# If we have a dump file, load it.
|
||||||
|
|
||||||
|
|
@ -473,7 +473,7 @@ if [[ -z "$_i_done" ]]; then
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
(\#autoload)
|
(\#autoload)
|
||||||
autoload -U "$_i_line[@]" ${_i_name}
|
autoload -Uz "$_i_line[@]" ${_i_name}
|
||||||
[[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line"
|
[[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -505,6 +505,6 @@ if [[ ${_i_line[2]} = expand-or-complete ]] &&
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unfunction compinit compaudit
|
unfunction compinit compaudit
|
||||||
autoload -U compinit compaudit
|
autoload -Uz compinit compaudit
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ local compcontext=-default-
|
||||||
__ci_tidyup() {
|
__ci_tidyup() {
|
||||||
unfunction -m __ci_\* 2>/dev/null
|
unfunction -m __ci_\* 2>/dev/null
|
||||||
unfunction compinstall
|
unfunction compinstall
|
||||||
autoload -U compinstall
|
autoload -Uz compinstall
|
||||||
}
|
}
|
||||||
|
|
||||||
__ci_newline() {
|
__ci_newline() {
|
||||||
|
|
@ -119,7 +119,7 @@ ${match[3]}"
|
||||||
then
|
then
|
||||||
compinit_args=$match[1]
|
compinit_args=$match[1]
|
||||||
elif [[ $line != [[:blank:]]# &&
|
elif [[ $line != [[:blank:]]# &&
|
||||||
$line != [[:blank:]]#'autoload -U compinit' &&
|
$line != [[:blank:]]#'autoload -Uz compinit' &&
|
||||||
$line != [[:blank:]]#compinit &&
|
$line != [[:blank:]]#compinit &&
|
||||||
$line != [[:blank:]]#zstyle[[:blank:]]#:compinstall* ]]; then
|
$line != [[:blank:]]#zstyle[[:blank:]]#:compinstall* ]]; then
|
||||||
warn_unknown="${warn_unknown:+$warn_unknown
|
warn_unknown="${warn_unknown:+$warn_unknown
|
||||||
|
|
@ -1886,7 +1886,7 @@ $output"
|
||||||
[[ -n $fpath_line ]] && print -r "$fpath_line"
|
[[ -n $fpath_line ]] && print -r "$fpath_line"
|
||||||
|
|
||||||
print -r "
|
print -r "
|
||||||
autoload -U compinit
|
autoload -Uz compinit
|
||||||
compinit${compinit_args:+ $compinit_args}"
|
compinit${compinit_args:+ $compinit_args}"
|
||||||
|
|
||||||
print -r "$endline"
|
print -r "$endline"
|
||||||
|
|
|
||||||
|
|
@ -2406,9 +2406,16 @@ bin_functions(char *name, char **argv, Options ops, int func)
|
||||||
on |= PM_TAGGED;
|
on |= PM_TAGGED;
|
||||||
else if (OPT_PLUS(ops,'t'))
|
else if (OPT_PLUS(ops,'t'))
|
||||||
off |= PM_TAGGED;
|
off |= PM_TAGGED;
|
||||||
|
if (OPT_MINUS(ops,'z'))
|
||||||
|
on |= PM_ZSHSTORED;
|
||||||
|
else if (OPT_PLUS(ops,'z'))
|
||||||
|
off |= PM_ZSHSTORED;
|
||||||
|
if (OPT_MINUS(ops,'k'))
|
||||||
|
on |= PM_KSHSTORED;
|
||||||
|
else if (OPT_PLUS(ops,'k'))
|
||||||
|
off |= PM_KSHSTORED;
|
||||||
|
|
||||||
if ((off & PM_UNDEFINED) || (OPT_ISSET(ops,'k') && OPT_ISSET(ops,'z')) ||
|
if ((off & PM_UNDEFINED) || (OPT_ISSET(ops,'k') && OPT_ISSET(ops,'z')) ||
|
||||||
(!OPT_PLUS(ops,'X') && (OPT_ISSET(ops,'k') || OPT_ISSET(ops,'z'))) ||
|
|
||||||
(OPT_MINUS(ops,'X') && (OPT_ISSET(ops,'m') || *argv || !scriptname))) {
|
(OPT_MINUS(ops,'X') && (OPT_ISSET(ops,'m') || *argv || !scriptname))) {
|
||||||
zwarnnam(name, "invalid option(s)", NULL, 0);
|
zwarnnam(name, "invalid option(s)", NULL, 0);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
||||||
|
|
@ -3398,8 +3398,12 @@ loadautofn(Shfunc shf, int fksh, int autol)
|
||||||
prog = getfpfunc(shf->nam, &ksh);
|
prog = getfpfunc(shf->nam, &ksh);
|
||||||
noaliases = noalias;
|
noaliases = noalias;
|
||||||
|
|
||||||
if (ksh == 1)
|
if (ksh == 1) {
|
||||||
ksh = fksh;
|
ksh = fksh;
|
||||||
|
if (ksh == 1)
|
||||||
|
ksh = (shf->flags & PM_KSHSTORED) ? 2 :
|
||||||
|
(shf->flags & PM_ZSHSTORED) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (prog == &dummy_eprog) {
|
if (prog == &dummy_eprog) {
|
||||||
/* We're not actually in the function; decrement locallevel */
|
/* We're not actually in the function; decrement locallevel */
|
||||||
|
|
|
||||||
|
|
@ -863,7 +863,7 @@ static void
|
||||||
printshfuncnode(HashNode hn, int printflags)
|
printshfuncnode(HashNode hn, int printflags)
|
||||||
{
|
{
|
||||||
Shfunc f = (Shfunc) hn;
|
Shfunc f = (Shfunc) hn;
|
||||||
char *t;
|
char *t = 0;
|
||||||
|
|
||||||
if ((printflags & PRINT_NAMEONLY) ||
|
if ((printflags & PRINT_NAMEONLY) ||
|
||||||
((printflags & PRINT_WHENCE_SIMPLE) &&
|
((printflags & PRINT_WHENCE_SIMPLE) &&
|
||||||
|
|
@ -881,32 +881,35 @@ printshfuncnode(HashNode hn, int printflags)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->flags & PM_UNDEFINED)
|
|
||||||
t = tricat("builtin autoload -X",
|
|
||||||
((f->flags & PM_UNALIASED)? "U" : ""),
|
|
||||||
((f->flags & PM_TAGGED)? "t" : ""));
|
|
||||||
else {
|
|
||||||
if (!f->funcdef)
|
|
||||||
t = 0;
|
|
||||||
else
|
|
||||||
t = getpermtext(f->funcdef, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
quotedzputs(f->nam, stdout);
|
quotedzputs(f->nam, stdout);
|
||||||
if (t) {
|
if (f->funcdef || f->flags & PM_UNDEFINED) {
|
||||||
printf(" () {\n\t");
|
printf(" () {\n\t");
|
||||||
if (f->flags & PM_UNDEFINED)
|
if (f->flags & PM_UNDEFINED)
|
||||||
printf("%c undefined\n\t", hashchar);
|
printf("%c undefined\n\t", hashchar);
|
||||||
|
else
|
||||||
|
t = getpermtext(f->funcdef, NULL);
|
||||||
if (f->flags & PM_TAGGED)
|
if (f->flags & PM_TAGGED)
|
||||||
printf("%c traced\n\t", hashchar);
|
printf("%c traced\n\t", hashchar);
|
||||||
zputs(t, stdout);
|
if (!t) {
|
||||||
if (f->funcdef && (f->funcdef->flags & EF_RUN)) {
|
char *fopt = "Utkz";
|
||||||
printf("\n\t");
|
int flgs[] = {
|
||||||
quotedzputs(f->nam, stdout);
|
PM_UNALIASED, PM_TAGGED, PM_KSHSTORED, PM_ZSHSTORED, 0
|
||||||
printf(" \"$@\"");
|
};
|
||||||
}
|
int fl;;
|
||||||
|
|
||||||
|
zputs("builtin autoload -X", stdout);
|
||||||
|
for (fl=0;fopt[fl];fl++)
|
||||||
|
if (f->flags & flgs[fl]) putchar(fopt[fl]);
|
||||||
|
} else {
|
||||||
|
zputs(t, stdout);
|
||||||
|
zsfree(t);
|
||||||
|
if (f->funcdef->flags & EF_RUN) {
|
||||||
|
printf("\n\t");
|
||||||
|
quotedzputs(f->nam, stdout);
|
||||||
|
printf(" \"$@\"");
|
||||||
|
}
|
||||||
|
}
|
||||||
printf("\n}\n");
|
printf("\n}\n");
|
||||||
zsfree(t);
|
|
||||||
} else {
|
} else {
|
||||||
printf(" () { }\n");
|
printf(" () { }\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1197,6 +1197,9 @@ struct tieddata {
|
||||||
#define PM_HIDEVAL (1<<15) /* Value not shown in `typeset' commands */
|
#define PM_HIDEVAL (1<<15) /* Value not shown in `typeset' commands */
|
||||||
#define PM_TIED (1<<16) /* array tied to colon-path or v.v. */
|
#define PM_TIED (1<<16) /* array tied to colon-path or v.v. */
|
||||||
|
|
||||||
|
#define PM_KSHSTORED (1<<17) /* function stored in ksh form */
|
||||||
|
#define PM_ZSHSTORED (1<<18) /* function stored in zsh form */
|
||||||
|
|
||||||
/* Remaining flags do not correspond directly to command line arguments */
|
/* Remaining flags do not correspond directly to command line arguments */
|
||||||
#define PM_LOCAL (1<<21) /* this parameter will be made local */
|
#define PM_LOCAL (1<<21) /* this parameter will be made local */
|
||||||
#define PM_SPECIAL (1<<22) /* special builtin parameter */
|
#define PM_SPECIAL (1<<22) /* special builtin parameter */
|
||||||
|
|
@ -1210,7 +1213,7 @@ struct tieddata {
|
||||||
#define PM_NAMEDDIR (1<<30) /* has a corresponding nameddirtab entry */
|
#define PM_NAMEDDIR (1<<30) /* has a corresponding nameddirtab entry */
|
||||||
|
|
||||||
/* The option string corresponds to the first of the variables above */
|
/* The option string corresponds to the first of the variables above */
|
||||||
#define TYPESET_OPTSTR "aiEFALRZlurtxUhHT"
|
#define TYPESET_OPTSTR "aiEFALRZlurtxUhHTkz"
|
||||||
|
|
||||||
/* These typeset options take an optional numeric argument */
|
/* These typeset options take an optional numeric argument */
|
||||||
#define TYPESET_OPTNUM "LRZiEF"
|
#define TYPESET_OPTNUM "LRZiEF"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue