about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-18 10:05:45 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-18 10:05:45 +0000
commit092472dab755645333186e1398f6b261ec6fa112 (patch)
treea5cb784bfaa32dc2e22211db9cec273ab96c78c4 /Completion
parentfe461d9a8c154010db7d8f06d059fa1cb4e61081 (diff)
downloadzsh-092472dab755645333186e1398f6b261ec6fa112.tar.gz
zsh-092472dab755645333186e1398f6b261ec6fa112.tar.xz
zsh-092472dab755645333186e1398f6b261ec6fa112.zip
zsh-workers/8665
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Core/_funcall32
-rw-r--r--Completion/Core/compinit29
-rw-r--r--Completion/Linux/_rpm2
-rw-r--r--Completion/User/_nslookup8
4 files changed, 37 insertions, 34 deletions
diff --git a/Completion/Core/_funcall b/Completion/Core/_funcall
new file mode 100644
index 000000000..540f8ae83
--- /dev/null
+++ b/Completion/Core/_funcall
@@ -0,0 +1,32 @@
+#autoload
+
+# Utility function to call a function if it exists.
+#
+# Usage: _funcall <return> <name> [ <args> ... ]
+#
+# If a function named <name> is defined (or defined to be autoloaded),
+# it is called. If <return> is given not the string `-' or empty, it is
+# taken as the name of a parameter and the return status of the function
+# called is stored in this parameter. All other arguments are given
+# to the function called.
+# The return value of this function is zero if the function was
+# called and non-zero otherwise.
+
+local _name _ret
+
+[[ "$1" != (|-) ]] && _name="$1"
+
+shift
+
+if (( $+functions[$1] )); then
+  "$@"
+  _ret="$?"
+
+  [[ -n "$_name" ]] && eval "${_name}=${_ret}"
+
+  compstate[restore]=''
+
+  return 0
+fi
+
+return 1
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index c2a78e99a..2f69f26c9 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -497,35 +497,6 @@ compstyle ':correct' accept        '2n'
 compstyle ':correct' prompt        'correct to:'
 compstyle '*'        completer     '_complete'
 
-# Utility function to call a function if it exists.
-#
-# Usage: funcall <return> <name> [ <args> ... ]
-#
-# If a function named <name> is defined (or defined to be autoloaded),
-# it is called. If <return> is given not the string `-' or empty, it is
-# taken as the name of a parameter and the return status of the function
-# called is stored in this parameter. All other arguments are given
-# to the function called.
-# The return value of this function is zero if the function was
-# called and non-zero otherwise.
-
-funcall() {
-  local _name _ret
-
-  [[ "$1" != (|-) ]] && _name="$1"
-
-  shift
-
-  if (( $+functions[$1] )); then
-    "$@"
-    _ret="$?"
-    [[ -n "$_name" ]] && eval "${_name}=${_ret}"
-    compstate[restore]=''
-    return 0
-  fi
-  return 1
-}
-
 # Now we automatically make the definition files autoloaded.
 
 typeset -U _i_files
diff --git a/Completion/Linux/_rpm b/Completion/Linux/_rpm
index eb30924dc..b31ea656f 100644
--- a/Completion/Linux/_rpm
+++ b/Completion/Linux/_rpm
@@ -79,7 +79,7 @@ while [[ -n "$state" ]]; do
 
   # First try to call a user-defined function.
 
-  funcall ret _rpm_$state && return ret
+  _funcall ret _rpm_$state && return ret
 
   # Copy the state and reset `state', to simplify the test above.
 
diff --git a/Completion/User/_nslookup b/Completion/User/_nslookup
index 495a0e3de..13500ff2c 100644
--- a/Completion/User/_nslookup
+++ b/Completion/User/_nslookup
@@ -50,7 +50,7 @@ setopts=(
 if [[ -n "$compcontext" ]]; then
   if [[ CURRENT -eq 1 ]]; then
 
-    funcall ret _nslookup_command && return ret
+    _funcall ret _nslookup_command && return ret
 
     _alternative \
         'commands:command:compadd server lserver root finger ls view help set' \
@@ -58,7 +58,7 @@ if [[ -n "$compcontext" ]]; then
     return ret
   elif [[ "$compstate[context]" = redirect ]]; then
 
-    funcall ret _nslookup_redirect && return ret
+    _funcall ret _nslookup_redirect && return ret
 
     _tags -C redirection files || return 1
 
@@ -79,9 +79,9 @@ if [[ -n "$compcontext" ]]; then
   fi
 
   if [[ "$words[1]" = [a-z]## ]]; then
-    funcall ret _nslookup_$words[1] && return ret
+    _funcall ret _nslookup_$words[1] && return ret
   else
-    funcall ret _nslookup_host && return ret
+    _funcall ret _nslookup_host && return ret
   fi
 
   case "$words[1]" in