diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2012-01-22 16:22:20 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2012-01-22 16:22:20 +0100 |
commit | dbd9bc55f629891c29373398120d8af7e2c44732 (patch) | |
tree | 7a4f6a02ad876cdd236dbe6a8d68e172dc50a9e4 | |
parent | 1a3a8694a6eae1e140d746e4c21769cdd56971c0 (diff) | |
parent | 09532a70ead07a600a3d2258837d6e3fe943f2fd (diff) | |
download | zsh-dbd9bc55f629891c29373398120d8af7e2c44732.tar.gz zsh-dbd9bc55f629891c29373398120d8af7e2c44732.zip |
Merge branch 'upstream' into debian
37 files changed, 849 insertions, 508 deletions
@@ -1,3 +1,117 @@ +2011-12-17 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * unposted: release 4.3.15. + +2011-12-16 Peter Stephenson <pws@csr.com> + + * Simon Olofsson: 30028: Completion/Unix/Command/_subversion: + fix matching of subversion help text. + +2011-12-14 Mikael Magnusson <mikachu@gmail.com> + + * 30021: Completion/Zsh/Type/_globquals: Add d flag (see 29991), + show what unit the digits are entered in as a hint that the + default is also days. + + * 29783: Completion/Debian/Command/_update-alternatives: Add + more options. + +2011-12-13 Mikael Magnusson <mikachu@gmail.com> + + * 29998: Completion/Unix/Command/_git: fix a typo (--rerbose). + + * 30019: Completion/Unix/Command/_tar: fix parsing of argument + to -C. + +2011-12-13 Barton E. Schaefer <schaefer@zsh.org> + + * 30020: Functions/Prompts/promptinit: prevent prompt_opts and + zle_highlight from leaking out of prompt_preview_theme. + + * 30012: Completion/Base/Core/_main_complete, + Completion/Base/Utility/_arguments, + Completion/Base/Utility/_values, Completion/Zsh/Command/_zle, + Doc/Zsh/compsys.yo: add $state_descr which parallels the $state + array in the same way that $context does, to make the "message" + part of each _arguments "optarg" specification available to + the caller's state handler. Used in _zle as the description + passed to _wanted. + +2011-12-12 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 30000 plus a couple of comments: Src/exec.c: Better POSIXJOBS + behaviour: don't restore default behaviour for SIGTTOU etc. if + we're still doing job handling, and only continue with job + handling if this is a (...) subshell. + +2011-12-11 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * discussed in 29984: Doc/Zsh/compsys.yo: use m+7 for files + "more than a week old" since w+1 is a bit counterintuitive. + + * 29991: Doc/Zsh/expn.yo, Src/glob.c: allow explicit 'd' for + days in time qualifiers. + +2011-12-10 Mikael Magnusson <mikachu@gmail.com> + + * 29962: Completion/Unix/Command/_ssh: Actually return ret. + + * 29961: Completion/Unix/Command/_ssh: Extend option completion. + +2011-12-10 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * GI: 29977: Completion/Linux/Command/_modutils: caching and + function definition fixes. + +2011-12-09 Simon Ruderich <simon@ruderich.org> + + * 29918: Completion: Add new _remote_files() helper and use it to + reduce code duplication. + + * 29917: Completion/Unix/Command/_ssh: Tabs to spaces. + +2011-12-09 Mikael Magnusson <mikachu@gmail.com> + + * unposted: Doc/Zsh/compsys.yo: Remove duplicated 'the'. + + * 29409: Completion/X/Command/_x_utils: Add completion for xprop and + xlsatoms. + +2011-12-09 Peter Stephenson <pws@csr.com> + + * unposted: Completion/compinit: add NO_ignoreclosebraces to + options needed in completion. + + * users/16614: config.guess, config.sub: update from automake + 1.11.1. + +2011-12-09 Mikael Magnusson <mikachu@gmail.com> + + * 29876: Completion/Unix/Command/_getent: Update getent completion + to work when additional output comes after the databases. + +2011-12-08 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 29955 with bits pointed out by Mikael and Bart: + Doc/Zsh/grammar.yo, Doc/Zsh/options.yo, Src/lex.c, + Src/options.c, Src/zsh.h, Test/E01options.ztst: add + IGNORE_CLOSE_BRACES option. + +2011-12-08 Peter Stephenson <pws@csr.com> + + * 29928: Test/A04redirect.ztst: belated commit to + fix OpenBSD test failure. + +2011-12-07 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * unposted: Etc/version.mk: update version to 4.3.14-dev-0 to + avoid installs clashing with release. + +2011-12-07 Oliver Kiddle <okiddle@yahoo.co.uk> + + * 29952: Src/glob.c: fix cut'n'paste error in nanosecond + timestamp support + 2011-12-06 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted: Config/version.mk: release 4.3.14. @@ -2098,11 +2212,11 @@ * users/15314: Doc/Zsh/expn.yo: redescribe process substitution. - * users/15310 (bits applying to process substitution with + * users/15301 (bits applying to process substitution with redirection): Src/exec.c: make redirection process substitution attach to the appropriate process group. - * users/15200: pass foreground signals on to process + * users/15300: pass foreground signals on to process substitutions in current shell 2010-08-22 Barton E. Schaefer <schaefer@zsh.org> @@ -15657,5 +15771,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5517 $ +* $Revision: 1.5544 $ ***************************************************** diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index c50ff9db4..9bc5611de 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -23,7 +23,8 @@ eval "$_comp_setup" local func funcs ret=1 tmp _compskip format nm call match min max i num\ _completers _completer _completer_num curtag _comp_force_list \ _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg \ - mesg str context state line opt_args val_args curcontext="$curcontext" \ + mesg str context state state_descr line opt_args val_args \ + curcontext="$curcontext" \ _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \ _tags_level=0 \ _saved_exact="${compstate[exact]}" \ diff --git a/Completion/Base/Utility/.distfiles b/Completion/Base/Utility/.distfiles index 97d86bdbf..d5e359ae7 100644 --- a/Completion/Base/Utility/.distfiles +++ b/Completion/Base/Utility/.distfiles @@ -5,5 +5,5 @@ _arg_compile _combination _regex_arguments _values _arguments _set_command _retrieve_cache _guard _cache_invalid _describe _sep_parts _pick_variant _call_function _multi_parts _store_cache _regex_words -_complete_help_generic +_complete_help_generic _remote_files ' diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 126d9c315..d70c44259 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -344,6 +344,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then context=() state=() + state_descr=() while true; do while _tags; do @@ -376,6 +377,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then if (( ! $state[(I)$action] )); then comparguments -W line opt_args state+=( "$action" ) + state_descr+=( "$descr" ) if [[ -n "$usecc" ]]; then curcontext="${oldcontext%:*}:$subc" else diff --git a/Completion/Base/Utility/_remote_files b/Completion/Base/Utility/_remote_files new file mode 100644 index 000000000..c35e3d3fa --- /dev/null +++ b/Completion/Base/Utility/_remote_files @@ -0,0 +1,77 @@ +#autoload + +# Complete files on remote systems using SSH (and other programs). Needs +# key-based authentication with no passwords or a running ssh-agent to work. +# +# Usage: +# _remote_files [--no-files] [--no-dirs] -- <cmd> [<cmd options>] +# +# Options: +# - --no-files: don't complete remote files +# - --no-dirs: don't complete remote directories +# +# Commands: +# - ssh: Additional options for non-interactive use are automatically added +# (see below). +# - All other commands are used unaltered. +# +# Examples: +# - _remote_files -- ssh +# Use ssh to retrieve the remote paths. The "--" is not optional! +# - _remote_files --no-files -- ssh -2 -p 42 +# Use ssh with the option -2 and -p 42 to retrieve the remote paths and +# complete only directories. +# - _remote_files -- rsh +# Use rsh to retrieve the remote paths. + + +# There should be coloring based on all the different ls -F classifiers. +local expl rempat remfiles remdispf remdispd args cmd cmd_args suf ret=1 + +if zstyle -T ":completion:${curcontext}:files" remote-access; then + + # Parse options to _remote_files. Stops at the first "--". + zparseopts -D -E -a args -no-files -no-dirs + shift + + # Command to run on the remote system. + cmd="$1" + shift + + # Handle arguments to ssh. + if [[ $cmd == ssh ]]; then + zparseopts -D -E -a cmd_args p: 1 2 4 6 F: + cmd_args="-o BatchMode=yes $cmd_args -a -x" + else + cmd_args="$@" + fi + + if [[ -z $QIPREFIX ]] + then rempat="${PREFIX%%[^./][^/]#}\*" + else rempat="${(q)PREFIX%%[^./][^/]#}\*" + fi + + remfiles=(${(M)${(f)"$(_call_program files $cmd $cmd_args ${IPREFIX%:} ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) + + compset -P '*/' + compset -S '/*' || suf='remote file' + + remdispf=(${remfiles:#*/}) + remdispd=(${(M)remfiles:#*/}) + + _tags files + while _tags; do + while _next_label files expl ${suf:-remote directory}; do + [[ ${args[(I)--no-files]} -eq 0 ]] && \ + [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ + ${(q)remdispf%[*=@|]} && ret=0 + [[ ${args[(I)--no-dirs]} -eq 0 ]] && \ + compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ + ${(q)remdispd%/} && ret=0 + done + (( ret )) || return 0 + done + return ret +else + _message -e remote-files 'remote file' +fi diff --git a/Completion/Base/Utility/_values b/Completion/Base/Utility/_values index c2ae26465..ab0e46a9c 100644 --- a/Completion/Base/Utility/_values +++ b/Completion/Base/Utility/_values @@ -87,6 +87,7 @@ if compvalues -i "$@"; then if [[ "$action" = -\>* ]]; then compvalues -v val_args state="${${action[3,-1]##[ ]#}%%[ ]#}" + state_descr="$descr" if [[ -n "$usecc" ]]; then curcontext="${oldcontext%:*}:$subc" else diff --git a/Completion/Debian/Command/_update-alternatives b/Completion/Debian/Command/_update-alternatives index dd1d4fce3..ccf5084bf 100644 --- a/Completion/Debian/Command/_update-alternatives +++ b/Completion/Debian/Command/_update-alternatives @@ -16,11 +16,21 @@ _arguments -C \ '--version' \ '--altdir:altdir:_files -/' \ '--admindir:admindir:_files -/' \ + '--log:log file:_files -/' \ + '--force' \ + '--skip-auto' \ '--install:*::alt:= ->install' \ '--remove:*::alt:= ->remove' \ - '--auto:name:_files -W $alterdir' \ - '--display:name:_files -W $alterdir' \ - '--config:name:_files -W $alterdir' && return + '--remove-all:name:_files -W "$alterdir"' \ + '--auto:name:_files -W "$alterdir"' \ + '--display:name:_files -W "$alterdir"' \ + '--query:name:_files -W "$alterdir"' \ + '--list:name:_files -W "$alterdir"' \ + '--get-selections' \ + '--set-selections' \ + '--config:name:_files -W "$alterdir"' \ + '--set:name:_files -W "$alterdir":path:_files -/' \ + '--all' && return while true; do case "$state" in @@ -28,29 +38,29 @@ while true; do _call_function ret _update_alternatives_$state && return ret state= _arguments -C \ - '1:link:_files' \ - '2:name:_files -W $alterdir' \ - '3:path:_files' \ - '--slave:*::more:= ->islave' && return + '1:link:_files' \ + '2:name:_files -W "$alterdir"' \ + '3:path:_files' \ + '--slave:*::more:= ->islave' && return [[ -z $state ]] && return 1 ;; install) _call_function ret _update_alternatives_$state && return ret _arguments -C \ - '1:link:_files' \ - '2:name:_files -W $alterdir' \ - '3:path:_files' \ - '4:priority:' \ - '--slave:*::slave:= ->islave' && return + '1:link:_files' \ + '2:name:_files -W "$alterdir"' \ + '3:path:_files' \ + '4:priority:' \ + '--slave:*::slave:= ->islave' && return [[ -z $state ]] && return 1 ;; remove) _call_function ret _update_alternatives_$state && return ret _arguments \ - '1:name:_files -W $alterdir' \ - '2:path:_files' + '1:name:_files -W "$alterdir"' \ + '2:path:_files' return ;; diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index e2671f2a7..48aeee973 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -2,143 +2,145 @@ _modules_caching_policy() { - # Rebuild every week, or if $modules_dir is newer than the cache - local -a oldp + # Rebuild if $modules_dir is newer than the cache, or every week. + local -a oldp - oldp=( "$1"(Nmw+1) ) - (( $#oldp )) || [[ $modules_dir -nt $1 ]] + oldp=( "$1"(Nmw+0) ) + (( $#oldp )) || [[ $modules_dir -nt $1 ]] } -local curcontext="$curcontext" expl state line modules ign args ret=1 -local -r modules_dir=/lib/modules - -local update_policy -zstyle -s ":completion:*:*:$service:*" cache-policy update_policy -if [[ -z "$update_policy" ]]; then - zstyle ":completion:*:*:$service:*" cache-policy _modules_caching_policy -fi - -args=( - '(-)'{-V,--version}'[print version]' - '(-)'{-h,--help}'[print help text]' -) - -case "$service" in - lsmod) _arguments -s "$args[@]" && return ;; - - modinfo) - _arguments -s -C "$args[@]" \ - '(-)'{-a,--author}"[display the module's author]" \ - '(-)'{-d,--description}"[display the module's description]" \ - '(-)'{-l,--license}"[display the module's license]" \ - '(-)'{-n,--filename}"[display the module's filename]" \ - '(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \ - '(-)'{-F,--field}"[display only selected module's information]:module_field:( - alias author depends description filename license parm)" \ - '(-)-k[use modules from a different kernel version]:kernel_version:( - $(echo $modules_dir/*(/\:t)))' \ - '1:module file:->all_modules' && ret=0 - ;; - - modprobe) - ign='-h --help -V --version -c --showconfig' - _arguments -s -C "$args[@]" \ - "(-a --all $ign)"{-a,--all}'[load all matching modules]' \ - '(-)'{-c,--showconfig}'[show current configuration]' \ - "(-d --debug $ign)"{-d,--debug}'[print debug info]' \ - "(-k --autoclean $ign)"{-k,--autoclean}'[set autoclean]' \ - "(-n --show $ign)"{-n,--show}"[don't actually perform action]" \ - "(-q --quiet $ign)"{-q,--quiet}"[don't complain about insmod failures]" \ - "(-s --syslog $ign)"{-s,--syslog}'[report via syslog instead of stderr]' \ - "(* -t --type $ign)"{-t,--type}'[module type]:module type' \ - "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \ - '(-C --config)'{-C,--config}'[specify config file]:config file:_files' \ - "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \ - "(-l --list -t --type -a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \ - "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \ - "(-c $ign)1:modules:->loadable_modules" \ - "(-c -l --list -t --type $ign)*:params:->params" && ret=0 - - [[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules - ;; - - rmmod) - _arguments -s -C "$args[@]" \ - '(-a --all)'{-a,--all}'[remove all unused autocleanable modules]' \ - '(-e --persist)'{-e,--persist}'[save persistent data]' \ - '(-r --stacks)'{-r,--stacks}'[remove a module stack]' \ - '(-s --syslog)'{-s,--syslog}'[output to syslog]' \ - '(-v --verbose)'{-v,--verbose}'[be verbose]' \ - '*:loaded module:->loaded_modules' && ret=0 - ;; - - insmod) - _arguments \ - '1:module file:_files' \ - '*:module parameters:' && ret=0 - ;; -esac - -case "$state" in - loaded_modules|loadable_modules) - if [[ -r /proc/modules ]]; then - loaded_modules=(${${(f)"$(</proc/modules)"}%% *}) - elif [[ -x /sbin/lsmod ]]; then - loaded_modules=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *}) - else - return 1 - fi +_modutils() { + local curcontext="$curcontext" expl state line modules ign args ret=1 + local -r modules_dir=/lib/modules - if [[ $state = loaded_modules ]]; then - _wanted modules expl 'loaded module' compadd -a loaded_modules && return - return ret - fi - ;& - - all_modules) - local kver - integer kver_idx - if (( kver_idx=${words[(I)-k]} )); then - kver=${words[kver_idx+1]} - else - kver=$(uname -r) - fi - if [[ -z $modules ]] && ! _cache_invalid modules-$kver && \ - ! _retrieve_cache modules-$kver; - then - # 2011-01-02 gi1242: Do we need .o files? Or is .ko enough? - modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz)(.:t:r:r) ) - _store_cache modules-$kver modules + local update_policy + zstyle -s ":completion:*:*:$service:*" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:*:*:$service:*" cache-policy _modules_caching_policy fi - if [[ $state = loadable_modules ]]; then - modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} ) - fi - - _tags files modules - while _tags; do - _requested files expl "module file" _files -g '*.ko' && ret=0 - _requested modules expl module compadd -a modules && ret=0 - done - ;; - - params) - if compset -P '*='; then - _message -e value 'parameter value' - else - local params - params=( ${${(M)${(f)"$(_call_program module_parameter modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) - if [[ $#params -eq 0 ]]; then - _message -e parameter "This modules doesn't have parameters" - else - typeset -A val_args - - _values -S = -C -w 'module parameter' \ - ${${${(M)params:#*(:bool|\(bool\))}/:/[}/(bool| \(bool\))/]} \ - ${^${params:#*(:bool|\(bool\))}/:/[}"]:auto added argument: " && ret=0 - fi - fi - ;; -esac + args=( + '(-)'{-V,--version}'[print version]' + '(-)'{-h,--help}'[print help text]' + ) + + case "$service" in + lsmod) _arguments -s "$args[@]" && return ;; + + modinfo) + _arguments -s -C "$args[@]" \ + '(-)'{-a,--author}"[display the module's author]" \ + '(-)'{-d,--description}"[display the module's description]" \ + '(-)'{-l,--license}"[display the module's license]" \ + '(-)'{-n,--filename}"[display the module's filename]" \ + '(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \ + '(-)'{-F,--field}"[display only selected module's information]:module_field:(alias author depends description filename license parm)" \ + '(-)-k[use modules from a different kernel version]:kernel_version:($(echo $modules_dir/*(/\:t)))' \ + '1:module file:->all_modules' && ret=0 + ;; + + modprobe) + ign='-h --help -V --version -c --showconfig' + _arguments -s -C "$args[@]" \ + "(-a --all $ign)"{-a,--all}'[load all matching modules]' \ + '(-)'{-c,--showconfig}'[show current configuration]' \ + "(-d --debug $ign)"{-d,--debug}'[print debug info]' \ + "(-k --autoclean $ign)"{-k,--autoclean}'[set autoclean]' \ + "(-n --show $ign)"{-n,--show}"[don't actually perform action]" \ + "(-q --quiet $ign)"{-q,--quiet}"[don't complain about insmod failures]" \ + "(-s --syslog $ign)"{-s,--syslog}'[report via syslog instead of stderr]' \ + "(* -t --type $ign)"{-t,--type}'[module type]:module type' \ + "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \ + '(-C --config)'{-C,--config}'[specify config file]:config file:_files' \ + "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \ + "(-l --list -t --type -a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \ + "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \ + "(-c $ign)1:modules:->loadable_modules" \ + "(-c -l --list -t --type $ign)*:params:->params" && ret=0 + + [[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules + ;; + + rmmod) + _arguments -s -C "$args[@]" \ + '(-a --all)'{-a,--all}'[remove all unused autocleanable modules]' \ + '(-e --persist)'{-e,--persist}'[save persistent data]' \ + '(-r --stacks)'{-r,--stacks}'[remove a module stack]' \ + '(-s --syslog)'{-s,--syslog}'[output to syslog]' \ + '(-v --verbose)'{-v,--verbose}'[be verbose]' \ + '*:loaded module:->loaded_modules' && ret=0 + ;; + + insmod) + _arguments \ + '1:module file:_files' \ + '*:module parameters:' && ret=0 + ;; + esac + + case "$state" in + loaded_modules|loadable_modules) + if [[ -r /proc/modules ]]; then + loaded_modules=(${${(f)"$(</proc/modules)"}%% *}) + elif [[ -x /sbin/lsmod ]]; then + loaded_modules=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *}) + else + return 1 + fi + + if [[ $state = loaded_modules ]]; then + _wanted modules expl 'loaded module' compadd -a loaded_modules \ + && return + return ret + fi + ;& + + all_modules) + local kver + integer kver_idx + if (( kver_idx=${words[(I)-k]} )); then + kver=${words[kver_idx+1]} + else + kver=$(uname -r) + fi + + if _cache_invalid modules-$kver || ! _retrieve_cache modules-$kver; + then + # 2011-01-02 gi1242: Do we need .o files? Or is .ko enough? + modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz)(.:t:r:r) ) + _store_cache modules-$kver modules + fi + + if [[ $state = loadable_modules ]]; then + modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} ) + fi + + _tags files modules + while _tags; do + _requested files expl "module file" _files -g '*.ko' && ret=0 + _requested modules expl module compadd -a modules && ret=0 + done + ;; + + params) + if compset -P '*='; then + _message -e value 'parameter value' + else + local params + params=( ${${(M)${(f)"$(_call_program module_parameter modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) + if [[ $#params -eq 0 ]]; then + _message -e parameter "This modules doesn't have parameters" + else + typeset -A val_args + + _values -S = -C -w 'module parameter' \ + ${${${(M)params:#*(:bool|\(bool\))}/:/[}/(bool| \(bool\))/]} ${^${params:#*(:bool|\(bool\))}/:/[}"]:auto added argument: " && ret=0 + fi + fi + ;; + esac + + return ret +} -return ret +_modutils "$@" diff --git a/Completion/Unix/Command/_getent b/Completion/Unix/Command/_getent index 57d2ec256..9644fa35b 100755 --- a/Completion/Unix/Command/_getent +++ b/Completion/Unix/Command/_getent @@ -25,8 +25,9 @@ case $state in ;; databases) if [[ $is_gnu = gnu ]]; then - databases=( ${=${${(f)"$(_call_program databases $words[1] --help \ - 2>/dev/null)"}[(r)Supported*,-1]}[2,-1]} ) + databases=( "${(@)${(@f)$(_call_program databases $words[1] --help \ + 2>/dev/null)}[(r)Supported*,-1]}" ) + databases=( "${=${(@)databases[2,${(@)databases[(i)]}-1]}}" ) else databases=( passwd group hosts ipnodes services protocols ethers networks netmasks ) fi diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 4a830f281..8a48c04b7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -2619,7 +2619,7 @@ _git-pack-refs () { _git-prune () { _arguments -S \ '(-n --dry-run)'{-n,--dry-run}'[do not remove anything; just report what would be removed]' \ - '(-v --verbose)'{-v,--rerbose}'[report all removed objects]' \ + '(-v --verbose)'{-v,--verbose}'[report all removed objects]' \ '--expire[only expire loose objects older than given date]: :__git_datetimes' \ '*:: :__git_heads' } @@ -5444,39 +5444,6 @@ __git_tree_files () { # Repository Argument Types -# _remote_files -_remote_files_git () { - # FIXME: these should be imported from _ssh - # TODO: this should take -/ to only get directories - # There should be coloring based on all the different ls -F classifiers. - local expl rempat remfiles remdispf remdispd args suf ret=1 - - if zstyle -T ":completion:${curcontext}:files" remote-access; then - zparseopts -D -E -a args p: 1 2 4 6 F: - if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" - fi - remfiles=(${(M)${(f)"$(_call_program files ssh $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - return ret - else - _message -e remote-files 'remote file' - fi -} - (( $+functions[__git_remote_repositories] )) || __git_remote_repositories () { local service @@ -5484,7 +5451,7 @@ __git_remote_repositories () { service= _ssh if compset -P '*:'; then - _remote_files_git + _remote_files --no-files -- ssh else _ssh_hosts -S: fi diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin index 0d8355bfb..a04c6d068 100644 --- a/Completion/Unix/Command/_rlogin +++ b/Completion/Unix/Command/_rlogin @@ -1,32 +1,5 @@ #compdef rlogin rsh remsh=rsh rcp -_rcp_remote_files () { - # There should be coloring based on all the different ls -F classifiers. - local expl remfiles remdispf remdispd suf ret=1 - - if zstyle -T ":completion:${curcontext}:" remote-access; then - remfiles=(${(M)${(f)"$(rsh ${IPREFIX%:} ls -d1F ${(Q)PREFIX%%[^./][^/]#}\* 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - else - _message -e remote-files 'remote file' - fi -} - _rlogin () { case "$service" in rlogin) @@ -65,7 +38,7 @@ _rlogin () { if [[ -n "$state" ]]; then if compset -P '*:'; then - _rcp_remote_files && ret=0 + _remote_files -- rsh && ret=0 elif compset -P '*@'; then _wanted hosts expl host _rlogin_hosts -S: && ret=0 else diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index b999c1bbd..f24a06e47 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -59,33 +59,7 @@ elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then elif compset -P 'rsync://'; then _rsync_user_or_host / "$@" elif compset -P 1 '*:'; then - - if zstyle -T ":completion:${curcontext}:files" remote-access; then - if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" - fi - remfiles=(${(M)${(f)"$(_call_program files ssh -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - else - _message -e remote-files 'remote file' - fi - + _remote_files -- ssh else _rsync_user_or_host : "$@" fi diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 0ec9c84a0..8f1fb74aa 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -5,40 +5,6 @@ # TODO: update ssh-keygen (not based on 5.9) # TODO: sshd, ssh-keyscan, ssh-keysign - -_remote_files () { - # There should be coloring based on all the different ls -F classifiers. - local expl rempat remfiles remdispf remdispd args suf ret=1 - - if zstyle -T ":completion:${curcontext}:files" remote-access; then - zparseopts -D -E -a args p: 1 2 4 6 F: - if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" - fi - remfiles=(${(M)${(f)"$(_call_program files ssh -o BatchMode=yes $args -a -x ${IPREFIX%:} ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) - compset -P '*/' - compset -S '/*' || suf='remote file' - - remdispf=(${remfiles:#*/}) - remdispd=(${(M)remfiles:#*/}) - - _tags files - while _tags; do - while _next_label files expl ${suf:-remote directory}; do - [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ - ${(q)remdispf%[*=@|]} && ret=0 - compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 - done - (( ret )) || return 0 - done - return ret - else - _message -e remote-files 'remote file' - fi -} - _ssh () { local curcontext="$curcontext" state line expl common tmp cmds suf ret=1 typeset -A opt_args @@ -49,6 +15,7 @@ _ssh () { '(-6)-4[forces ssh to use IPv4 addresses only]' '(-4)-6[forces ssh to use IPv6 addresses only]' '-C[compress data]' + # for protocol version 2, this can be a comma-separated list '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' '-F+[specify alternate config file]:config file:_files' '-i+[select identity file]:SSH identity file:_files' @@ -70,25 +37,20 @@ _ssh () { '(-a)-A[enables forwarding of the authentication agent connection]' \ '(-A)-a[disable forwarding of authentication agent connection]' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ - '-D+[specify a dynamic port forwarding]:[bind-address]\:port' \ - '-e+[set escape character]:escape character (or `none'"'"'):' \ + '-D+[specify a dynamic port forwarding]:dynamic port forwarding:->dynforward' \ + '-e+[set escape character]:escape character (or `none'\''):' \ '(-n)-f[go to background]' \ '-g[allow remote hosts to connect to local forwarded ports]' \ - '-I+[specify the PKCS#11 shared library to use]' \ + '-I+[specify smartcard device]:device:_files' \ '-K[enable GSSAPI-based authentication and forwarding]' \ '-k[disable forwarding of GSSAPI credentials]' \ '*-L[specify local port forwarding]:local port forwarding:->forward' \ '-l+[specify login name]:login name:_ssh_users' \ '-M[master mode for connection sharing]' \ - '(-1)-m+[specify mac algorithms]:mac spec' \ + '(-1)-m+[specify mac algorithms]:mac spec:->macs' \ '(-1)-N[do not execute a remote command (protocol version 2 only)]' \ '-n[redirect stdin from /dev/null]' \ - '-O[control active connection multiplexing master process]:multiplex control command:(( - check\:"check that the master process is running" - forward\:"request forwardings without command execution" - cancel\:"cancel forwardings" - exit\:"request the master to exit" - stop\:"request the master to stop accepting further multiplexing requests"))' \ + '-O:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests"))' \ '-P[use non privileged port]' \ '-p+[specify port on remote host]:port number on remote host' \ '(-v)*-q[quiet operation]' \ @@ -99,19 +61,19 @@ _ssh () { '(-T)-t[force pseudo-tty allocation]' \ '-V[show version number]' \ '(-q)*-v[verbose mode]' \ - '(-N)-W[forward standard input/output over host:port (protocol version 2 only)]:host\:port' \ - '-w[request tunnel device forwarding with the specified tun devices]:local_tun[\:remote_tun]' \ + '-W[forward standard input and output to host]:stdinout forward:->hostport' \ + '-w[request tunnel device forwarding]:local_tun[\:remote_tun] (integer or "any"):' \ '(-x -Y)-X[enable (untrusted) X11 forwarding]' \ '(-X -Y)-x[disable X11 forwarding]' \ '(-x -X)-Y[enable trusted X11 forwarding]' \ - '-y[send log information using the syslog module]' \ + '-y[send log info via syslog instead of stderr]' \ ':remote host name:->userhost' \ '*::args:->command' "$common[@]" && ret=0 ;; scp) _arguments -C -s \ '-3[copy through local host, not directly between the remote hosts]' \ - '-B[batch mode (don'"'"'t ask for passphrases)]' \ + '-B[batch mode (don'\''t ask for passphrases)]' \ '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) @@ -146,7 +108,7 @@ _ssh () { _arguments \ '-q[silence ssh-keygen]' \ "($cmds -P)-b[specify number of bits in key]:bits in key" \ - "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa)" \ + "($cmds -P)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa)" \ "(${cmds#-p })-N[provide new passphrase]:new passphrase" \ "($cmds -b -t)-C[provide new comment]:new comment" \ '(-D)-f[key file]:key file:_files' \ @@ -179,83 +141,209 @@ _ssh () { case "$lstate" in option) - if compset -P '*[= ]'; then + if compset -P '*='; then case "$IPREFIX" in - *(#i)(afstokenpassing|batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|useprivileged)*) - _wanted values expl 'truth value' compadd yes no && ret=0 + *(#i)(afstokenpassing|batchmode|challengeresponseauthentication|checkhostip|clearallforwardings|compression|enablesshkeysign|exitonforwardfailure|fallbacktorsh|forward(agent|x11)|forwardx11trusted|gatewayports|gssapiauthentication|gssapidelegatecredentials|gssapitrustdns|hashknownhosts|hostbasedauthentication|identitiesonly|kbdinteractiveauthentication|(tcp|)keepalive|nohostauthenticationforlocalhost|passwordauthentication|permitlocalcommand|pubkeyauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authentication|tgtpassing)|useprivilegedport|visualhostkey)=*) + _wanted values expl 'truth value' compadd yes no && ret=0 + ;; + *(#i)addressfamily=*) + _wanted values expl 'address family' compadd any inet inet6 && ret=0 ;; - *(#i)ciphers*) + *(#i)bindaddress=*) + _wanted bind-addresses expl 'bind address' _bind_addresses && ret=0 + ;; + *(#i)ciphers=*) _values -s , 'encryption cipher' \ - '3des-cbc' \ - 'aes128-cbc' \ - 'aes192-cbc' \ - 'aes256-cbc' \ - 'aes128-ctr' \ - 'aes192-ctr' \ - 'aes256-ctr' \ - 'arcfour128' \ - 'arcfour256' \ - 'arcfour' \ - 'blowfish-cbc' \ - 'cast128-cbc' \ - \ - 'rijndael128-cbc' \ - 'rijndael192-cbc' \ - 'rijndael256-cbc' \ - 'rijndael-cbc@lysator.liu.se' \ - && ret=0 - ;; - *(#i)cipher*) - _wanted values expl 'encryption cipher (protocol version 1)' \ + '3des-cbc' \ + 'aes128-cbc' \ + 'aes192-cbc' \ + 'aes256-cbc' \ + 'aes128-ctr' \ + 'aes192-ctr' \ + 'aes256-ctr' \ + 'arcfour128' \ + 'arcfour256' \ + 'arcfour' \ + 'blowfish-cbc' \ + 'cast128-cbc' \ + \ + 'rijndael128-cbc' \ + 'rijndael192-cbc' \ + 'rijndael256-cbc' \ + 'rijndael-cbc@lysator.liu.se' \ + && ret=0 + ;; + *(#i)cipher=*) + _wanted values expl 'encryption cipher (protocol version 1)' \ compadd blowfish 3des des idea arcfour tss none && ret=0 ;; - *(#i)controlmaster*) - _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 - ;; - *(#i)controlpath*) + *(#i)compressionlevel=*) + _values 'compression level' {1..9} && ret=0 + ;; + *(#i)connectionattempts=*) + _message -e 'connection attempts' && ret=0 + ;; + *(#i)connecttimeout=*) + _message -e 'connection timeout' && ret=0 + ;; + *(#i)controlmaster=*) + _wanted values expl 'truthish value' compadd yes no auto autoask && ret=0 + ;; + *(#i)controlpath=*) _description files expl 'path to control socket' _files "$expl[@]" && ret=0 - ;; - *(#i)globalknownhostsfile*) + ;; + *(#i)controlpersist=*) + _message -e 'timeout' + ret=0 + _wanted values expl 'truth value' compadd yes no && ret=0 + ;; + *(#i)escapechar=*) + _message -e 'escape character (or `none'\'')' + ret=0 + ;; + *(#i)forwardx11timeout=*) + _message -e 'timeout' + ret=0 + ;; + *(#i)globalknownhostsfile=*) _description files expl 'global file with known hosts' _files "$expl[@]" && ret=0 ;; - *(#i)hostname*) - _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 + *(#i)hostname=*) + _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0 ;; - *(#i)identityfile*) + *(#i)hostkeyalgorithms=*) + _values -s , 'host key algorithms' \ + 'ecdsa-sha2-nistp256-cert-v01@openssh.com' \ + 'ecdsa-sha2-nistp384-cert-v01@openssh.com' \ + 'ecdsa-sha2-nistp521-cert-v01@openssh.com' \ + 'ssh-rsa-cert-v01@openssh.com' \ + 'ssh-dss-cert-v01@openssh.com' \ + 'ssh-rsa-cert-v00@openssh.com' \ + 'ssh-dss-cert-v00@openssh.com' \ + 'ecdsa-sha2-nistp256' \ + 'ecdsa-sha2-nistp384' \ + 'ecdsa-sha2-nistp521' \ + 'ssh-rsa' \ + 'ssh-dss' && ret=0 + ;; + *(#i)identityfile=*) _description files expl 'SSH identity file' _files "$expl[@]" && ret=0 ;; - *(#i)(local|remote)forward*) + *(#i)ipqos=*) + local descr + if [[ $PREFIX = *\ *\ * ]]; then return 1; fi + if compset -P '* '; then + descr='QoS for non-interactive sessions' + else + descr='QoS [for interactive sessions if second value given, separated by white space]' + fi + _values $descr 'af11' 'af12' 'af13' 'af14' 'af22' \ + 'af23' 'af31' 'af32' 'af33' 'af41' 'af42' 'af43' \ + 'cs0' 'cs1' 'cs2' 'cs3' 'cs4' 'cs5' 'cs6' 'cs7' 'ef' \ + 'lowdelay' 'throughput' 'reliability' && ret=0 + ;; + *(#i)(local|remote)forward=*) state=forward ;; - *(#i)preferredauthentications*) + *(#i)dynamicforward=*) + state=dynforward + ;; + *(#i)kbdinteractivedevices=*) + _values -s , 'keyboard-interactive authentication methods' \ + 'bsdauth' 'pam' 'skey' && ret=0 + ;; + *(#i)kexalgorithms=*) + _values -s , 'KEX algorithms' \ + ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 \ + diffie-hellman-group-exchange-sha256 \ + diffie-hellman-group-exchange-sha1 \ + diffie-hellman-group14-sha1 diffie-hellman-group1-sha1 && ret=0 + ;; + *(#i)localcommand=*) + _description commands expl 'run command locally after connecting' + _command_names && ret=0 + ;; + *(#i)loglevel=*) + _values 'log level' QUIET FATAL ERROR INFO VERBOSE\ + DEBUG DEBUG1 DEBUG2 DEBUG3 && ret=0 + ;; + *(#i)macs=*) + state=macs + ;; + *(#i)numberofpasswordprompts=*) + _message -e 'number of password prompts' + ret=0 + ;; + *(#i)pkcs11provider=*) + _description files expl 'PKCS#11 shared library' + _files -g '*.so' "$expl[@]" && ret=0 + ;; + *(#i)port=*) + _message -e 'port number on remote host' + ret=0 + ;; + *(#i)preferredauthentications=*) _values -s , 'authentication method' gssapi-with-mic \ hostbased publickey keyboard-interactive password && ret=0 ;; - *(#i)protocol*) + *(#i)protocol=*) _values -s , 'protocol version' \ - '1' \ - '2' && ret=0 - ;; - *(#i)proxycommand*) + '1' \ + '2' && ret=0 + ;; + *(#i)proxycommand=*) compset -q shift 1 words (( CURRENT-- )) _normal && ret=0 ;; - *(#i)stricthostkeychecking*) + *(#i)rekeylimit=*) + _message -e 'maximum number of bytes transmitted before renegotiating session key' + ret=0 + ;; + *(#i)requesttty=*) + _values 'request a pseudo-tty' \ + 'no[never request a TTY]' \ + 'yes[always request a TTY when stdin is a TTY]' \ + 'force[always request a TTY]' \ + 'auto[request a TTY when opening a login session]' && ret=0 + ;; + *(#i)sendenv=*) + _wanted envs expl 'environment variable' _parameters -g 'scalar*export*' && ret=0 + ;; + *(#i)serveralivecountmax=*) + _message -e 'number of alive messages without replies before disconnecting' + ret=0 + ;; + *(#i)serveraliveinterval=*) + _message -e 'timeout in seconds since last data was received to send alive message' + ret=0 + ;; + *(#i)(stricthostkeychecking|verifyhostkeydns)=*) _wanted values expl 'checking type' compadd yes no ask && ret=0 ;; - *(#i)userknownhostsfile*) + *(#i)tunnel=*) + _values 'request device forwarding' \ + 'yes' \ + 'point-to-point' \ + 'ethernet' \ + 'no' && ret=0 + ;; + *(#i)tunneldevice=*) + _message -e 'local_tun[:remote_tun] (integer or "any")' + ret=0 + ;; + *(#i)userknownhostsfile=*) _description files expl 'user file with known hosts' _files "$expl[@]" && ret=0 ;; - *(#i)user*) - _wanted users expl 'user to log in as' _ssh_users && ret=0 + *(#i)user=*) + _wanted users expl 'user to log in as' _ssh_users && ret=0 ;; - *(#i)xauthlocation*) + *(#i)xauthlocation=*) _description files expl 'xauth program' _files "$expl[@]" -g '*(-*)' && ret=0 ;; @@ -263,7 +351,7 @@ _ssh () { else # old options are after the empty "\"-line _wanted values expl 'configure file option' \ - compadd -M 'm:{a-z}={A-Z}' -qS '=' - \ + compadd -M 'm:{a-z}={A-Z}' -S '=' - \ AddressFamily \ BatchMode \ BindAddress \ @@ -291,6 +379,7 @@ _ssh () { GlobalKnownHostsFile \ GSSAPIAuthentication \ GSSAPIDelegateCredentials \ + GSSAPITrustDns \ HashKnownHosts \ Host \ HostbasedAuthentication \ @@ -351,16 +440,56 @@ _ssh () { fi ;; forward) + local port=false host=false listen=false bind=false if compset -P 1 '*:'; then - if compset -P '*:'; then - _message -e port-numbers 'port number' + if [[ $IPREFIX != (*=|)<-65535>: ]]; then + if compset -P 1 '*:'; then + if compset -P '*:'; then + port=true + else + host=true + fi + else + listen=true + ret=0 + fi else - _wanted hosts expl host _ssh_hosts -qS: + if compset -P '*:'; then + port=true + else + host=true + fi fi else - _message -e port-numbers 'listen-port number' + listen=true + bind=true fi - return + $port && { _message -e port-numbers 'port number'; ret=0 } + $listen && { _message -e port-numbers 'listen-port number'; ret=0 } + $host && { _wanted hosts expl host _ssh_hosts -S: && ret=0 } + $bind && { _wanted bind-addresses expl bind-address _bind_addresses -S: && ret=0 } + return ret + ;; + dynforward) + _message -e port-numbers 'listen-port number' + if ! compset -P '*:'; then + _wanted bind-addresses expl bind-address _bind_addresses -qS: + fi + return 0 + ;; + hostport) + if compset -P '*:'; then + _message -e port-numbers 'port number' + ret=0 + else + _wanted hosts expl host _ssh_hosts -S: && ret=0 + fi + return ret + ;; + macs) + _values -s , 'MAC algorithms' hmac-md5 hmac-sha1 umac-64@openssh.com \ + hmac-ripemd160 hmac-sha1-96 hmac-md5-96 hmac-sha2-256 \ + hmac-sha2-256-96 hmac-sha2-512 hmac-sha2-512-96 && ret=0 ;; command) shift 1 words @@ -370,47 +499,49 @@ _ssh () { ;; userhost) if compset -P '*@'; then - _wanted hosts expl 'remote host name' _ssh_hosts && ret=0 + _wanted hosts expl 'remote host name' _ssh_hosts && ret=0 elif compset -S '@*'; then _wanted users expl 'login name' _ssh_users -S '' && ret=0 else if (( $+opt_args[-l] )); then - tmp=() - else - tmp=( 'users:login name:_ssh_users -qS@' ) - fi - _alternative \ - 'hosts:remote host name:_ssh_hosts' \ - "$tmp[@]" && ret=0 + tmp=() + else + tmp=( 'users:login name:_ssh_users -qS@' ) + fi + _alternative \ + 'hosts:remote host name:_ssh_hosts' \ + "$tmp[@]" && ret=0 fi ;; file) if compset -P '*:'; then - _remote_files ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0 + _remote_files -- ssh ${(kv)~opt_args[(I)-[FP1246]]/-P/-p} && ret=0 elif compset -P '*@'; then suf=( -S '' ) compset -S ':*' || suf=( -r: -S: ) _wanted hosts expl 'remote host name' _ssh_hosts $suf && ret=0 else _alternative \ - 'files:: _files' \ - 'hosts:remote host name:_ssh_hosts -r: -S:' \ - 'users:user:_ssh_users -qS@' && ret=0 + 'files:: _files' \ + 'hosts:remote host name:_ssh_hosts -r: -S:' \ + 'users:user:_ssh_users -qS@' && ret=0 fi ;; rfile) if compset -P '*:'; then - _remote_files && ret=0 + _remote_files -- ssh && ret=0 elif compset -P '*@'; then _wanted hosts expl host _ssh_hosts -r: -S: && ret=0 else _alternative \ - 'hosts:remote host name:_ssh_hosts -r: -S:' \ - 'users:user:_ssh_users -qS@' && ret=0 + 'hosts:remote host name:_ssh_hosts -r: -S:' \ + 'users:user:_ssh_users -qS@' && ret=0 fi ;; esac done + + return ret } _ssh_users () { @@ -438,17 +569,17 @@ _ssh_hosts () { local IFS=$'\t ' key hosts host while read key hosts; do if [[ "$key" == (#i)host ]]; then - for host in ${(z)hosts}; do - case $host in - (*[*?]*) ;; - (*) config_hosts+=("$host") ;; - esac - done + for host in ${(z)hosts}; do + case $host in + (*[*?]*) ;; + (*) config_hosts+=("$host") ;; + esac + done fi done < "$config" if (( ${#config_hosts} )); then _wanted hosts expl 'remote host name' \ - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts + compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts fi fi } diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 88142d805..21d809dd1 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -48,7 +48,7 @@ _svn () { ! _retrieve_cache svn-${cmd}-args; then args=( - ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} + ${=${${${(M)${(f)"$(LC_ALL=C _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) _store_cache svn-${cmd}-args args fi diff --git a/Completion/Unix/Command/_tar b/Completion/Unix/Command/_tar index 4f3247291..ce5852453 100644 --- a/Completion/Unix/Command/_tar +++ b/Completion/Unix/Command/_tar @@ -177,7 +177,7 @@ else fi fi if (( index )); then - index="$~words[index+1]" + index=${~${(Q)words[index+1]}} [[ $index = (.|..|)/* ]] || index=~+/$index _files -W $index else diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils index 2e672fdc0..0ff0cf268 100644 --- a/Completion/X/Command/_x_utils +++ b/Completion/X/Command/_x_utils @@ -1,4 +1,6 @@ -#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb +#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb xprop xlsatoms + +local ret=1 oret expl case "$service" in xdpyinfo) @@ -13,6 +15,27 @@ xwininfo) '(-id -root)-name:name: _x_window -n' \ '(-name -root)-id:id: _x_window' ;; +xprop) + _x_arguments \ + -{help,frame,notype,spy} \ + '-grammar[show grammar for command line options]' \ + '(-id -name)-root[use the root window as the target window]' \ + '(-id -root)-name[specify target window by name]:name: _x_window -n' \ + '(-name -root)-id[specify target window by window id]:id: _x_window' \ + '-font[display the properties of a font]:font: _x_font' \ + '-len[show at most n bytes of any property]:n' \ + '*-fs[read more property formats from file]:file: _files' \ + '*-remove[specify an atom to remove from the target window]:atoms:->atoms' \ + '*-set[specify an atom and a value to set on the target window]:atoms:->atoms:value' \ + '*-f:atoms:->atoms:format: ::dformat' \ + '*:atoms:->atoms' && ret=0 + ;; +xlsatoms) + _x_arguments \ + '*-format[printf-style format to use]:format' \ + '*-range[atom values to list]:[num]-[num]' \ + '*-name[name of single atom to print]:atom:->atoms' + ;; xkill) _x_arguments \ -frame \ @@ -163,3 +186,11 @@ xrdb) '*:defaults file:_files' ;; esac + +oret=$? +if [[ $state == atoms ]]; then + _wanted atoms expl atoms compadd ${${(f)"$(_call_program atoms xlsatoms 2> /dev/null)"}#*$'\t'} && ret=0 +else + ret=$oret +fi +return ret diff --git a/Completion/X/Type/_x_font b/Completion/X/Type/_x_font index 134cfdf1c..a363b2775 100644 --- a/Completion/X/Type/_x_font +++ b/Completion/X/Type/_x_font @@ -9,7 +9,7 @@ _tags fonts || return 1 if (( ! $+_font_cache )); then typeset -gU _font_cache - _font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts)}%%--*}--" ) + _font_cache=( "${(@)^${(@f)$(_call_program fonts xlsfonts 2> /dev/null)}%%--*}--" ) fi _wanted fonts expl font \ diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle index 80f217711..2bfc708e5 100644 --- a/Completion/Zsh/Command/_zle +++ b/Completion/Zsh/Command/_zle @@ -44,7 +44,7 @@ case "$state[1]" in '(-)*:widget arguments: ' && ret=0 ;; (widget*) - _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0 + _wanted -C "$context[1]" widgets expl "${state_descr[1]:-widget}" compadd -k widgets && ret=0 ;& (function) [[ $state[1] != *function ]] || # Handle fall-through diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals index 778dfa822..9de7742ff 100644 --- a/Completion/Zsh/Type/_globquals +++ b/Completion/Zsh/Type/_globquals @@ -1,7 +1,8 @@ #autoload -local state=qual expl char delim +local state=qual expl char delim timespec local -a alts +local -A specmap while [[ -n $PREFIX ]]; do char=$PREFIX[1] @@ -111,18 +112,19 @@ while [[ -n $PREFIX ]]; do ;; ([amc]) - if ! compset -P '([Mwhms]|)([-+]|)<->'; then + if ! compset -P '([Mwhmsd]|)([-+]|)<->'; then # complete/skip relative time spec alts=() - if ! compset -P '[Mwhms]' && [[ -z $PREFIX ]]; then - alts+=( - "time-specifiers:time specifier:\ -((M\:months w\:weeks h\:hours m:\minutes s\:seconds))") + timespec=$PREFIX[1] + if ! compset -P '[Mwhmsd]' && [[ -z $PREFIX ]]; then + alts+=("time-specifiers:time specifier:\ +((M\:months w\:weeks h\:hours m:\minutes s\:seconds d\:days))") fi if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then alts+=("senses:sense:((-\:less\ than +\:more\ than))") fi - alts+=('digits:digit: ') + specmap=( M months w weeks h hours m minutes s seconds '(|+|-|d)' days) + alts+=('digits:digit ('${${specmap[(K)$timespec]}:-invalid time specifier}'):' ) _alternative $alts return fi diff --git a/Completion/compinit b/Completion/compinit index d25642e5d..489d662c3 100644 --- a/Completion/compinit +++ b/Completion/compinit @@ -144,6 +144,7 @@ _comp_options=( NO_globsubst NO_histsubstpattern NO_ignorebraces + NO_ignoreclosebraces NO_kshglob NO_ksharrays NO_kshtypeset diff --git a/Config/version.mk b/Config/version.mk index 0380bcba2..4fe21a1dd 100644 --- a/Config/version.mk +++ b/Config/version.mk @@ -27,5 +27,5 @@ # This must also serve as a shell script, so do not add spaces around the # `=' signs. -VERSION=4.3.14 -VERSION_DATE='December 6, 2011' +VERSION=4.3.15 +VERSION_DATE='December 17, 2011' diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index e07ac0e9e..665c0d454 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3687,10 +3687,12 @@ state of processing; the calling function then makes its own arrangements for generating completions. For example, functions that implement a state machine can use this type of action. -Where tt(_arguments) encounters a `tt(->)var(string)', it will strip -all leading and trailing whitespace from var(string) and set the array -tt(state) to the set of all var(strings)s for which an action is to be -performed. +Where tt(_arguments) encounters var(action) in the `tt(->)var(string)' +format, it will strip all leading and trailing whitespace from var(string) +and set the array tt(state) to the set of all var(string)s for which an +action is to be performed. The elements of the array tt(state_descr) are +assigned the corresponding var(message) field from each var(optarg) +containing such an var(action). By default and in common with all other well behaved completion functions, _arguments returns status zero if it was able to add matches and @@ -3698,7 +3700,8 @@ non-zero otherwise. However, if the tt(-R) option is given, tt(_arguments) will instead return a status of 300 to indicate that tt($state) is to be handled. -In addition to tt($state), tt(_arguments) also sets the global +In addition to tt($state) and tt($state_descr), tt(_arguments) also +sets the global parameters `tt(context)', `tt(line)' and `tt(opt_args)' as described below, and does not reset any changes made to the special parameters such as tt(PREFIX) and tt(words). This gives the calling function the @@ -3708,7 +3711,7 @@ A function calling tt(_arguments) with at least one action containing a `tt(->)var(string)' must therefore declare appropriate local parameters: -example(local context state line +example(local context state state_descr line typeset -A opt_args) to prevent tt(_arguments) from altering the global environment. @@ -3970,7 +3973,7 @@ Example: example(_example_caching_policy () { # rebuild if cache is more than a week old local -a oldp - oldp=( "$1"(Nmw+1) ) + oldp=( "$1"(Nm+7) ) (( $#oldp )) }) ) @@ -4794,21 +4797,23 @@ values (but not those for the arguments) should be printed. The associative array tt(val_args) is used to report values and their arguments; this works similarly to the tt(opt_args) associative array used by tt(_arguments). Hence the function calling tt(_values) should -declare the local parameters tt(state), tt(line), tt(context) and -tt(val_args): +declare the local parameters tt(state), tt(state_descr), tt(line), +tt(context) and tt(val_args): -example(local context state line +example(local context state state_descr line typeset -A val_args) when using an action of the form `tt(->)var(string)'. With this function the tt(context) parameter will be set to the name of the -value whose argument is to be completed. +value whose argument is to be completed. Note that for tt(_values), +the tt(state) and tt(state_descr) are scalars rather than arrays. +Only a single matching state is returned. Note also that tt(_values) normally adds the character used as the separator between values as an auto-removable suffix (similar to a `tt(/)' after a directory). However, this is not possible for a `tt(->)var(string)' action as the matches for the argument are -generated by the calling function. To get the usual behaviour, the +generated by the calling function. To get the usual behaviour, the calling function can add the separator var(x) as a suffix by passing the options `tt(-qS) var(x)' either directly or indirectly to tt(compadd). diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 28d525f14..25c44f331 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -2430,7 +2430,8 @@ Files accessed more than var(n) days ago are selected by a positive var(n) value (tt(PLUS())var(n)). Optional unit specifiers `tt(M)', `tt(w)', `tt(h)', `tt(m)' or `tt(s)' (e.g. `tt(ah5)') cause the check to be performed with months (of 30 days), weeks, hours, minutes or seconds -instead of days, respectively. +instead of days, respectively. An explicit `tt(d)' for days is also +allowed. Any fractional part of the difference between the access time and the current part in the appropriate units is ignored in the comparison. For diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo index 5c803a681..30fec79c6 100644 --- a/Doc/Zsh/grammar.yo +++ b/Doc/Zsh/grammar.yo @@ -449,8 +449,8 @@ tt(do done esac then elif else fi for case if while function repeat time until select coproc nocorrect foreach end ! [[ { }) -Additionally, `tt(})' is recognized in any position if the tt(IGNORE_BRACES) option -is not set. +Additionally, `tt(})' is recognized in any position if neither the +tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set. texinode(Comments)(Aliasing)(Reserved Words)(Shell Grammar) sect(Comments) cindex(comments) diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index 0e0176227..68247264f 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -548,7 +548,32 @@ cindex(disabling brace expansion) cindex(brace expansion, disabling) cindex(expansion, brace, disabling) item(tt(IGNORE_BRACES) (tt(-I)) <S>)( -Do not perform brace expansion. +Do not perform brace expansion. For historical reasons this +also includes the effect of the tt(IGNORE_CLOSE_BRACES) option. +) +pindex(IGNORE_CLOSE_BRACES) +pindex(NO_IGNORE_CLOSE_BRACES) +pindex(IGNORECLOSEBRACES) +pindex(NOIGNORECLOSEBRACES) +item(tt(IGNORE_CLOSE_BRACES))( +When neither this option nor tt(IGNORE_BRACES) is set, a sole +close brace character `tt(})' is syntactically significant at any +point on a command line. This has the effect that no semicolon +or newline is necessary before the brace terminating a function +or current shell construct. When either option is set, a closing brace +is syntactically significant only in command position. Unlike +tt(IGNORE_BRACES), this option does not disable brace expansion. + +For example, with both options unset a function may be defined +in the following fashion: + +example(args() { echo $# }) + +while if either option is set, this does not work and something +equivalent to the following is required: + +example(args() { echo $#; }) + ) pindex(KSH_GLOB) pindex(NO_KSH_GLOB) diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 973eea8ef..8db9b6d0c 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -302,10 +302,10 @@ sect(On what machines will it run?) sect(What's the latest version?) Zsh 4.2.7 is the latest production version. The latest development - version is 4.3.14; this contains support for multibyte character strings + version is 4.3.15; this contains support for multibyte character strings (such as UTF-8 locales). All the main features for multibyte support are now in place and this is likely soon to become the - stable series 4.4. + stable series 5.0. There will not be any further 4.2 releases. diff --git a/Functions/Prompts/promptinit b/Functions/Prompts/promptinit index 0aa810236..b07eabb1f 100644 --- a/Functions/Prompts/promptinit +++ b/Functions/Prompts/promptinit @@ -180,7 +180,8 @@ prompt_preview_theme () { emulate -L zsh local -a psv; psv=($psvar); local -a +h psvar; psvar=($psv) # Ick local +h PS1=$PS1 PS2=$PS2 PS3=$PS3 PS4=$PS4 RPS1=$RPS1 - local precmd_functions preexec_functions + local precmd_functions preexec_functions prompt_opts + local -aLl +h zle_highlight print -n "$1 theme" (( $#* > 1 )) && print -n " with parameters \`$*[2,-1]'" @@ -5,11 +5,11 @@ THE Z SHELL (ZSH) Version ------- -This is version 4.3.14 of the shell. This is a development release, +This is version 4.3.15 of the shell. This is a development release, but is believed to be reasonably stable. Sites where the users need to edit command lines with multibyte characters (in particular UTF-8) will probably want to upgrade. The previous widely released version -of the shell was 4.3.12. +of the shell was 4.3.14. Installing Zsh -------------- diff --git a/Src/exec.c b/Src/exec.c index 2c644e6b7..9b3c50372 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -896,14 +896,16 @@ enum { /* Release the process group if pid is the shell's process group */ ESUB_REVERTPGRP = 0x10, /* Don't handle the MONITOR option even if previously set */ - ESUB_NOMONITOR = 0x20 + ESUB_NOMONITOR = 0x20, + /* This is a subshell where job control is allowed */ + ESUB_JOB_CONTROL = 0x40 }; /**/ static void entersubsh(int flags) { - int sig, monitor; + int sig, monitor, job_control_ok; if (!(flags & ESUB_KEEPTRAP)) for (sig = 0; sig < VSIGCOUNT; sig++) @@ -911,6 +913,7 @@ entersubsh(int flags) sig != SIGDEBUG && sig != SIGZERR) unsettrap(sig); monitor = isset(MONITOR); + job_control_ok = monitor && (flags & ESUB_JOB_CONTROL) && isset(POSIXJOBS); if (flags & ESUB_NOMONITOR) opts[MONITOR] = 0; if (!isset(MONITOR)) { @@ -938,6 +941,16 @@ entersubsh(int flags) } else if (!jobtab[thisjob].gleader || setpgrp(0L, jobtab[thisjob].gleader) == -1) { + /* + * This is the standard point at which a newly started + * process gets put into the foreground by taking over + * the terminal. Note that in normal circumstances we do + * this only from the process itself. This only works if + * we are still ignoring SIGTTOU at this point; in this + * case ignoring the signal has the special effect that + * the operation is allowed to work (in addition to not + * causing the shell to be suspended). + */ jobtab[thisjob].gleader = getpid(); if (list_pipe_job != thisjob && !jobtab[list_pipe_job].gleader) @@ -959,7 +972,13 @@ entersubsh(int flags) if ((flags & ESUB_REVERTPGRP) && getpid() == mypgrp) release_pgrp(); shout = NULL; - if (isset(MONITOR)) { + if (!job_control_ok) { + /* + * If this process is not goign to be doing job control, + * we don't want to do special things with the corresponding + * signals. If it is, we need to keep the special behaviour: + * see note about attachtty() above. + */ signal_default(SIGTTOU); signal_default(SIGTTIN); signal_default(SIGTSTP); @@ -971,7 +990,7 @@ entersubsh(int flags) } if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED)) signal_default(SIGQUIT); - if (!isset(POSIXJOBS)) + if (!job_control_ok) opts[MONITOR] = 0; opts[USEZLE] = 0; zleactive = 0; @@ -2829,6 +2848,8 @@ execcmd(Estate state, int input, int output, int how, int last1) flags = ((how & Z_ASYNC) ? ESUB_ASYNC : 0) | ESUB_PGRP; if ((type != WC_SUBSH) && !(how & Z_ASYNC)) flags |= ESUB_KEEPTRAP; + if (type == WC_SUBSH && !(how & Z_ASYNC)) + flags |= ESUB_JOB_CONTROL; entersubsh(flags); close(synch[1]); forked = 1; diff --git a/Src/glob.c b/Src/glob.c index cf4a5a537..076d0392a 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -422,13 +422,13 @@ insert(char *s, int checked) matchptr->_ctime = buf2.st_ctime; matchptr->_links = buf2.st_nlink; #ifdef GET_ST_ATIME_NSEC - matchptr->_ansec = GET_ST_ATIME_NSEC(buf); + matchptr->_ansec = GET_ST_ATIME_NSEC(buf2); #endif #ifdef GET_ST_MTIME_NSEC - matchptr->_mnsec = GET_ST_MTIME_NSEC(buf); + matchptr->_mnsec = GET_ST_MTIME_NSEC(buf2); #endif #ifdef GET_ST_CTIME_NSEC - matchptr->_cnsec = GET_ST_CTIME_NSEC(buf); + matchptr->_cnsec = GET_ST_CTIME_NSEC(buf2); #endif } matchptr++; @@ -1530,6 +1530,8 @@ zglob(LinkList list, LinkNode np, int nountok) g_units = TT_MONTHS, ++s; else if (*s == 's') g_units = TT_SECONDS, ++s; + else if (*s == 'd') + ++s; } /* See if it's greater than, equal to, or less than */ if ((g_range = *s == '+' ? 1 : *s == '-' ? -1 : 0)) @@ -1857,7 +1857,8 @@ exalias(void) /* Then check for a reserved word */ if ((incmdpos || - (unset(IGNOREBRACES) && zshlextext[0] == '}' && !zshlextext[1])) && + (unset(IGNOREBRACES) && unset(IGNORECLOSEBRACES) && + zshlextext[0] == '}' && !zshlextext[1])) && (rw = (Reswd) reswdtab->getnode(reswdtab, zshlextext))) { tok = rw->token; if (tok == DINBRACK) diff --git a/Src/options.c b/Src/options.c index 00d552ad5..a70d4ff11 100644 --- a/Src/options.c +++ b/Src/options.c @@ -159,6 +159,7 @@ static struct optname optns[] = { {{NULL, "histverify", 0}, HISTVERIFY}, {{NULL, "hup", OPT_EMULATE|OPT_ZSH}, HUP}, {{NULL, "ignorebraces", OPT_EMULATE|OPT_SH}, IGNOREBRACES}, +{{NULL, "ignoreclosebraces", 0}, IGNORECLOSEBRACES}, {{NULL, "ignoreeof", 0}, IGNOREEOF}, {{NULL, "incappendhistory", 0}, INCAPPENDHISTORY}, {{NULL, "interactive", OPT_SPECIAL}, INTERACTIVE}, @@ -2005,6 +2005,7 @@ enum { HISTVERIFY, HUP, IGNOREBRACES, + IGNORECLOSEBRACES, IGNOREEOF, INCAPPENDHISTORY, INTERACTIVE, diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index 888a0d480..3911b0629 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -152,10 +152,11 @@ >hello >goodbye - (exec 3<&- + ({ exec 3<&- } 2>/dev/null + exec 3<&- read foo <&-) 1:'<&-' redirection -*?\(eval\):1: failed to close file descriptor 3:* +*?\(eval\):*: failed to close file descriptor 3:* print foo >&- 0:'>&-' redirection diff --git a/Test/E01options.ztst b/Test/E01options.ztst index 1bbfdbda1..bcb34c352 100644 --- a/Test/E01options.ztst +++ b/Test/E01options.ztst @@ -256,6 +256,8 @@ ?next one should fail ?(eval):1: parse error near `end' +# ` emacs deconfusion + setopt cshjunkiequotes print this should cause an error >&2 eval "print 'line one @@ -271,6 +273,8 @@ ?(eval):1: unmatched ' ?this should not +# ' emacs deconfusion + nullcmd() { print '$NULLCMD run'; } readnullcmd() { print 'Running $READNULLCMD'; cat; } NULLCMD=nullcmd @@ -901,6 +905,8 @@ ?(eval):exec:6: ls: restricted ?(eval):unsetopt:7: can't change option: restricted +# ' emacs deconfusion + fn() { print =ls ={ls,} local foo='=ls' @@ -1081,3 +1087,12 @@ ?+(eval):4> fn ?+fn:0> print message ?+(eval):5> unsetopt xtrace + + setopt ignoreclosebraces + eval "icb_test() { echo this is OK; }" + icb_test + icb_args() { print $#; } + eval "icb_args { this, is, ok, too }" +0:IGNORE_CLOSE_BRACES option +>this is OK +>6 diff --git a/config.guess b/config.guess index e3a2116a7..dc84c68ef 100755 --- a/config.guess +++ b/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-06-10' +timestamp='2009-11-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -27,16 +27,16 @@ timestamp='2009-06-10' # the same distribution terms that you use for the rest of that program. -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# Originally written by Per Bothner. Please send patches (context +# diff format) to <config-patches@gnu.org> and include a ChangeLog +# entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -333,6 +333,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" @@ -807,12 +810,12 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; - *:Interix*:[3456]*) + *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd | genuineintel) + authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -854,6 +857,20 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -876,6 +893,17 @@ EOF frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; @@ -901,39 +929,18 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -942,8 +949,11 @@ EOF *) echo hppa-unknown-linux-gnu ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux @@ -966,58 +976,6 @@ EOF xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1247,6 +1205,16 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} diff --git a/config.sub b/config.sub index eb0389a69..2a55a5075 100755 --- a/config.sub +++ b/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-06-11' +timestamp='2009-11-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -32,13 +32,16 @@ timestamp='2009-06-11' # Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. @@ -149,7 +152,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; @@ -284,6 +287,7 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ @@ -291,13 +295,14 @@ case $basic_machine in | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) + m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none @@ -340,7 +345,7 @@ case $basic_machine in | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -368,7 +373,7 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* \ + | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ @@ -377,6 +382,7 @@ case $basic_machine in | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ + | ubicom32-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ @@ -726,6 +732,9 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; + microblaze) + basic_machine=microblaze-xilinx + ;; mingw32) basic_machine=i386-pc os=-mingw32 @@ -1247,6 +1256,9 @@ case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; @@ -1268,8 +1280,8 @@ case $os in # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -kopensolaris* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ @@ -1290,7 +1302,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) |