about summary refs log tree commit diff
path: root/Completion/User/_whois
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-02 12:26:43 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-02 12:26:43 +0000
commit54c500a3f8779dee553c4a46a753c0cd1baef09d (patch)
treecf3169752b1ca6539b16f1671644a6fa08fe8999 /Completion/User/_whois
parent1c59511ca322a3a24f8b5b0f19a9f4d00b0242c3 (diff)
downloadzsh-54c500a3f8779dee553c4a46a753c0cd1baef09d.tar.gz
zsh-54c500a3f8779dee553c4a46a753c0cd1baef09d.tar.xz
zsh-54c500a3f8779dee553c4a46a753c0cd1baef09d.zip
zsh-workers/8484
Diffstat (limited to 'Completion/User/_whois')
-rw-r--r--Completion/User/_whois28
1 files changed, 17 insertions, 11 deletions
diff --git a/Completion/User/_whois b/Completion/User/_whois
index 580529a72..f64d3930e 100644
--- a/Completion/User/_whois
+++ b/Completion/User/_whois
@@ -5,7 +5,7 @@ _whois () {
   $_whois_comp
 }
 
-builtin functions _whois_setup >&- ||
+(( $+functions[_whois_setup] )) ||
 _whois_setup () {
   (( $+_whois_defaultserver )) ||
     _whois_defaultserver='whois.internic.net'
@@ -64,6 +64,7 @@ _whois_setup () {
   (( $+_whois_arguments )) || {
     local help="$(whois </dev/null 2>&1)"
     local tmp opt opts
+    local hostopt=-h+
 
     if [[ $help = *"user[@<whois.server>]"* ]]; then
       _whois_comp=_whois_fwhois
@@ -71,6 +72,7 @@ _whois_setup () {
       _whois_comp=_whois_multi
     else
       _whois_comp=_whois_single
+      hostopt=-h
     fi
 
     _whois_arguments=()
@@ -95,9 +97,13 @@ _whois_setup () {
     for opt in $tmp; do
       opts=(-${^tmp:#$opt})
       if (( $#opts )); then opts="($opts)"; else opts=; fi
-      _whois_arguments=("$_whois_arguments[@]"
-	"${opts}-${opt}[${${${(@M)_whois_servers:#*:$opt}%:?}:-specify host}]${(M)${(M)opt:#h}/h/:host:_whois_hosts}"
-      )
+      if [[ $opt = h ]]; then
+	_whois_arguments=("$_whois_arguments[@]"
+	  "${opts}${hostopt}[specify host]:host:_whois_hosts")
+      else
+	_whois_arguments=("$_whois_arguments[@]"
+	  "${opts}-${opt}[${${(@M)_whois_servers:#*:$opt}%:?}]")
+      fi
     done
   }
 }
@@ -113,7 +119,7 @@ _whois_single () {
 
   case "$state" in
   identifier)
-    if [[ -z "$QIPREFIX" ]]; then
+    if [[ -z "$QIPREFIX" && -z "$PREFIX" ]]; then
       compadd -QS '' \'
       return
     fi
@@ -125,7 +131,7 @@ _whois_single () {
         break
       fi
     done
-    if builtin functions "_whois:$host" >&-; then
+    if (( $+functions[_whois:$host] )); then
       "_whois:$host" "$expl[@]"
     else
       _message "identifier"
@@ -152,7 +158,7 @@ _whois_multi () {
         break
       fi
     done
-    if builtin functions "_whois:$host" >&-; then
+    if (( $+functions[_whois:$host] )); then
       "_whois:$host" "$expl[@]"
     else
       _message "identifier"
@@ -165,13 +171,13 @@ _whois_fwhois () {
   if compset -P '*@'; then
     _whois_hosts "$@"
   else
-    if [[ -z "$QIPREFIX" ]]; then
+    if [[ -z "$QIPREFIX" && -z "$PREFIX" ]]; then
       compadd -QS '' \'
       return
     fi
     compset -q
     host="$_whois_defaultserver"
-    if builtin functions "_whois:$host" >&-; then
+    if (( $+functions[_whois:$host] )); then
       "_whois:$host" "$@"
     else
       _message "identifier"
@@ -189,7 +195,7 @@ _whois_ports () {
   compadd "$@" - whois || _ports "$@"
 }
 
-builtin functions _whois:whois.internic.net >&- ||
+(( $+functions[_whois:whois.internic.net] )) ||
 _whois:whois.internic.net () {
   if (( CURRENT == 1 )); then
     compadd HELP DOMAIN HOST
@@ -198,7 +204,7 @@ _whois:whois.internic.net () {
   fi
 }
 
-builtin functions _whois:whois.nic.ad.jp >&- ||
+(( $+functions[_whois:whois.nic.ad.jp] )) ||
 _whois:whois.nic.ad.jp () {
   if (( CURRENT == 1 )); then
     compadd HELP DOM NET HOST PERSON CONN COM