diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Core/compaudit | 130 | ||||
-rw-r--r-- | Completion/Unix/Command/_dict | 21 | ||||
-rw-r--r-- | Completion/Unix/Type/.distfiles | 2 | ||||
-rw-r--r-- | Completion/Zsh/Command/.distfiles | 12 | ||||
-rw-r--r-- | Completion/compaudit | 10 | ||||
-rw-r--r-- | Completion/compinit | 4 | ||||
-rw-r--r-- | Completion/compinstall | 4 |
7 files changed, 17 insertions, 166 deletions
diff --git a/Completion/Core/compaudit b/Completion/Core/compaudit deleted file mode 100644 index 4ea31af58..000000000 --- a/Completion/Core/compaudit +++ /dev/null @@ -1,130 +0,0 @@ -# So that this file can also be read with `.' or `source' ... -compaudit() { # Define and then call - -# Audit the fpath to assure that it contains all the directories needed by -# the completion system, and that those directories are at least unlikely -# to contain dangerous files. This is far from perfect, as the modes or -# ownership of files or directories might change between the time of the -# audit and the time the function is executed. - -# This function is designed to be called from compinit, which assumes that -# it is in the same directory, i.e., it can be autoloaded from the initial -# fpath as compinit was. Most local parameter names in this function must -# therefore be the same as those used in compinit. - -emulate -L zsh -setopt extendedglob - -# The positional parameters are the directories to check, else fpath. -if (( $# )); then - local _compdir='' -elif (( $#fpath == 0 )); then - print 'compaudit: No directories in $fpath, cannot continue' 1>&2 - return 1 -else - set -- $fpath -fi - -# _i_check is defined by compinit; used here as a test for whether this -# function is running standalone or was called by compinit. If called -# by compinit, we use parameters that are defined in compinit's scope, -# otherwise we make them local here. -(( $+_i_check )) || { - local _i_q _i_line _i_file _i_fail=verbose - local -a _i_files _i_addfiles _i_wdirs _i_wfiles - local -a -U +h fpath -} - -fpath=( $* ) - -# _compdir may be defined by the user; see the compinit documentation. -# If it isn't defined, we want it to point somewhere sensible, but the -# user is allowed to set it to empty to bypass the check below. -(( $+_compdir )) || { - local _compdir=${fpath[(r)*/$ZSH_VERSION/*]} - [[ -z $_compdir ]] && _compdir=$fpath[1] - [[ -d $_compdir/../Core ]] && _compdir=${_compdir:h} -} - -_i_wdirs=() -_i_wfiles=() - -_i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) -if [[ -n $_compdir ]]; then - if [[ $#_i_files -lt 20 || $_compdir = */Core || -d $_compdir/Core ]]; then - # Too few files: we need some more directories, or we need to check - # that all directories (not just Core) are present. - _i_addfiles=() - if [[ $_compdir = */Core ]]; then - # Add all the Completion subdirectories - _i_addfiles=(${_compdir:h}/*(/)) - elif [[ -d $_compdir/Core ]]; then - # Likewise - _i_addfiles=(${_compdir}/*(/)) - fi - for _i_line in {1..$#i_addfiles}; do - _i_file=${_i_addfiles[$_i_line]} - [[ -d $_i_file && -z ${fpath[(r)$_i_file]} ]] || - _i_addfiles[$_i_line]= - done - fpath=($fpath $_i_addfiles) - _i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) - fi -fi - -[[ $_i_fail == use ]] && return 0 - -# RedHat Linux "per-user groups" check. This is tricky, because it's very -# difficult to tell whether the sysadmin has put someone else into your -# "private" group (e.g., via the default group field in /etc/passwd, or -# by NFS group sharing with an untrustworthy machine). So we must assume -# that this has not happened, and pick the best group. - -local GROUP GROUPMEM _i_pw _i_gid -while IFS=: read GROUP _i_pw _i_gid GROUPMEM; do - if (( UID == EUID )); then - [[ $GROUP == $LOGNAME ]] && break - else - (( _i_gid == EGID )) && break # Somewhat arbitrary - fi -done < /etc/group - -# We search for: -# - world/group-writable directories in fpath not owned by root and the user -# - parent-directories of directories in fpath that are world/group-writable -# and not owned by root and the user (that would allow someone to put a -# digest file for one of the directories into the parent directory) -# - digest files for one of the directories in fpath not owned by root and -# the user -# - and for files in directories from fpath not owned by root and the user -# (including zwc files) - -if [[ $GROUP == $LOGNAME && ( -z $GROUPMEM || $GROUPMEM == $LOGNAME ) ]]; then - _i_wdirs=( ${^fpath}(Nf:g+w:^g:${GROUP}:,f:o+w:,^u0u${EUID}) - ${^fpath}/..(Nf:g+w:^g:${GROUP}:,f:o+w:,^u0u${EUID}) ) -else - _i_wdirs=( ${^fpath}(Nf:g+w:,f:o+w:,^u0u${EUID}) - ${^fpath}/..(Nf:g+w:,f:o+w:,^u0u${EUID}) ) -fi -_i_wdirs=( $_i_wdirs ${^fpath}.zwc^([^_]*|*~)(N^u0u${EUID}) ) -_i_wfiles=( ${^fpath}/^([^_]*|*~)(N^u0u${EUID}) ) - -case "${#_i_wdirs}:${#_i_wfiles}" in -(0:0) _i_q= ;; -(0:*) _i_q=files ;; -(*:0) _i_q=directories ;; -(*:*) _i_q='directories and files' ;; -esac - -if [[ -n "$_i_q" ]]; then - [[ $_i_fail == verbose ]] && { - print There are insecure ${_i_q}: 1>&2 - print -l - $_i_wdirs $_i_wfiles - } - return 1 -fi -return 0 - -} # Define and then call - -compaudit "$@" diff --git a/Completion/Unix/Command/_dict b/Completion/Unix/Command/_dict index 228603dbe..31b89ee1c 100644 --- a/Completion/Unix/Command/_dict +++ b/Completion/Unix/Command/_dict @@ -1,24 +1,5 @@ #compdef dict -local expl dictresults dictwords j dict - -_dictwords() { - -[[ -z $words[CURRENT] ]] && return 1 - -dictresults=(${${(f)${"$(dict -m $words[CURRENT])":gs/ - / /}}:#[0-9]*matches found}) - -for j in ${dictresults} -do -dict=${j%%:*} -dictwords=(${(z)j#*:}) - -_wanted $dict expl "words from $dict" \ - compadd -M 'm:{a-zA-Z}={A-Za-z} r:|=*' -a "$@" - dictwords -done -} - _arguments \ '(--host)-h[host]:dict server:_hosts' \ '(-h)--host:dict server:_hosts' \ @@ -63,4 +44,4 @@ _arguments \ '--pipesize:buffer size:' \ '--client:client text:' \ '--debug:debug flag:(verbose raw scan parse pipe serial time)' \ - ':word:_dictwords' + ':word:_dict_words' diff --git a/Completion/Unix/Type/.distfiles b/Completion/Unix/Type/.distfiles index 1ae174230..2fa150d06 100644 --- a/Completion/Unix/Type/.distfiles +++ b/Completion/Unix/Type/.distfiles @@ -1,5 +1,6 @@ DISTFILES_SRC=' .distfiles +_dict_words _mailboxes _perl_modules _tex _diff_options _my_accounts _pids _texi _dir_list _newsgroups _ports _tilde_files _directories _other_accounts _printers _urls @@ -7,5 +8,4 @@ _domains _path_files _ps _user_at_host _files _pdf _pspdf _users _groups _perl_basepods _signals _users_on _hosts _perl_builtin_funcs _tar_archive -_mailboxes _perl_modules _tex ' diff --git a/Completion/Zsh/Command/.distfiles b/Completion/Zsh/Command/.distfiles index e77927278..66e1babd6 100644 --- a/Completion/Zsh/Command/.distfiles +++ b/Completion/Zsh/Command/.distfiles @@ -1,9 +1,9 @@ DISTFILES_SRC=' .distfiles -_autoload _disable _kill _sched _typeset _zftp -_bindkey _echotc _mere _set _unhash _zle -_builtin _emulate _precommand _setopt _unsetopt _zmodload -_cd _enable _print _source _wait _zpty -_command _fc _prompt _stat _which _zstyle -_compdef _hash _read _trap _zcompile _zed +_autoload _disable _kill _sched _typeset _zed +_bindkey _echotc _mere _set _unhash _zftp +_builtin _emulate _precommand _setopt _unsetopt _zle +_cd _enable _print _source _wait _zmodload +_command _fc _prompt _stat _which _zpty +_compdef _hash _read _trap _zcompile _zstyle ' diff --git a/Completion/compaudit b/Completion/compaudit index 4ea31af58..9cab88bbf 100644 --- a/Completion/compaudit +++ b/Completion/compaudit @@ -43,7 +43,7 @@ fpath=( $* ) (( $+_compdir )) || { local _compdir=${fpath[(r)*/$ZSH_VERSION/*]} [[ -z $_compdir ]] && _compdir=$fpath[1] - [[ -d $_compdir/../Core ]] && _compdir=${_compdir:h} + ### [[ -d $_compdir/../Base ]] && _compdir=${_compdir:h} } _i_wdirs=() @@ -51,14 +51,14 @@ _i_wfiles=() _i_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) ) if [[ -n $_compdir ]]; then - if [[ $#_i_files -lt 20 || $_compdir = */Core || -d $_compdir/Core ]]; then + if [[ $#_i_files -lt 20 || $_compdir = */Base || -d $_compdir/Base ]]; then # Too few files: we need some more directories, or we need to check - # that all directories (not just Core) are present. + # that all directories (not just Base) are present. _i_addfiles=() - if [[ $_compdir = */Core ]]; then + if [[ $_compdir = */Base ]]; then # Add all the Completion subdirectories _i_addfiles=(${_compdir:h}/*(/)) - elif [[ -d $_compdir/Core ]]; then + elif [[ -d $_compdir/Base ]]; then # Likewise _i_addfiles=(${_compdir}/*(/)) fi diff --git a/Completion/compinit b/Completion/compinit index 172fafc03..f846be42e 100644 --- a/Completion/compinit +++ b/Completion/compinit @@ -1,8 +1,8 @@ # Initialisation for new style completion. This mainly contains some helper -# functions and aliases. Everything else is split into different files that +# functions and setup. Everything else is split into different files that # will automatically be made autoloaded (see the end of this file). The # names of the files that will be considered for autoloading are those that -# begin with an underscores (like `_setopt'). +# begin with an underscores (like `_condition). # # The first line of each of these files is read and must indicate what # should be done with its contents: diff --git a/Completion/compinstall b/Completion/compinstall index ebae5bc43..971816ea8 100644 --- a/Completion/compinstall +++ b/Completion/compinstall @@ -190,9 +190,9 @@ __ci_set_compdir() { __ci_set_compdir $fpath -if [[ $compdir = */Core && -d $compdir/../Base ]]; then +if [[ -d $compdir/Base ]]; then subdirs=1 - compdir=${compdir:h} + ### compdir=${compdir:h} fi if [[ -z $compdir ]]; then |