summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_groups11
-rw-r--r--Completion/Unix/Type/_hosts12
-rw-r--r--Completion/Unix/Type/_printers8
4 files changed, 29 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b372ee59..a8a9f7cff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-18  Oliver Kiddle  <opk@zsh.org>
+
+	* 19436: Completion/Unix/Type/_groups, Completion/Unix/Type/_hosts,
+	Completion/Unix/Type/_printers: complete more things from nis
+
 2004-02-17  Peter Stephenson  <pws@csr.com>
 
 	* 19428: configure.ac, Src/Modules/pty.c: use configure to
diff --git a/Completion/Unix/Type/_groups b/Completion/Unix/Type/_groups
index bbb80868b..b6d599c28 100644
--- a/Completion/Unix/Type/_groups
+++ b/Completion/Unix/Type/_groups
@@ -6,11 +6,14 @@ _tags groups || return 1
 
 if ! zstyle -a ":completion:${curcontext}:" groups groups; then
   (( $+_cache_groups )) ||
-      if (( ${+commands[ypcat]} )) &&
-	  tmp=$(_call_program groups ypcat group.byname 2>/dev/null); then
-        : ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP
+      if (( ${+commands[getent]} )); then
+        : ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent group 2>/dev/null)}%%:*}}
       else
-        : ${(A)_cache_groups:=${${(s: :)$(</etc/group)}%%:*}}
+        : ${(A)_cache_groups:=${${${(s: :)$(</etc/group)}%%:*}:#+}}
+	if (( ${+commands[ypcat]} )) &&
+	    tmp=$(_call_program groups ypcat group.byname 2>/dev/null); then
+          _cache_groups+=( ${${(f)tmp}%%:*} ) # If you use YP
+	fi
       fi
 
   groups=( "$_cache_groups[@]" )
diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts
index a058b28da..e530c8b42 100644
--- a/Completion/Unix/Type/_hosts
+++ b/Completion/Unix/Type/_hosts
@@ -1,10 +1,18 @@
 #compdef ftp ping rwho rup xping traceroute host aaaa zone mx ns soa txt
 
-local expl hosts
+local expl hosts tmp
 
 if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
   (( $+_cache_hosts )) ||
-      : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
+      if (( ${+commands[getent]} )); then
+	: ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${(f)~~"$(_call_program hosts getent hosts 2>/dev/null)"}##[:blank:]#[^[:blank:]]#}}}
+      else
+        : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
+	if (( ${+commands[ypcat]} )) &&
+	    tmp=$(_call_program hosts ypcat hosts.byname 2>/dev/null); then
+          _cache_hosts+=( ${=${(f)tmp}##[:blank:]#[^[:blank:]]#} ) # If you use YP
+	fi
+      fi
 
   hosts=( "$_cache_hosts[@]" )
 fi
diff --git a/Completion/Unix/Type/_printers b/Completion/Unix/Type/_printers
index d736dd51d..02196daee 100644
--- a/Completion/Unix/Type/_printers
+++ b/Completion/Unix/Type/_printers
@@ -1,6 +1,6 @@
 #compdef -value-,PRINTER,-default- -value-,LPDEST,-default-
 
-local expl ret=1 list disp sep
+local expl ret=1 list disp sep tmp
 
 if (( $+commands[lsallq] )); then
   # Use AIX's command to list print queues
@@ -39,6 +39,12 @@ if (( ! $+_lp_cache )); then
       fi
     done < $file[1]
   fi
+
+  if [[ $OSTYPE = solaris* ]] && (( ${+commands[ypcat]} )) &&
+      tmp=$(_call_program printers ypcat printers.conf.byname 2>/dev/null); then
+    _lp_cache+=( ${${${(S)${(f)tmp}/(#b):*((#e)|description=([^:]#):)*/:${match[2]}|}%%|*}:#_default*} ) # If you use YP
+  fi
+
   (( $#_lp_cache )) || _lp_cache=( 'lp0:Guessed default printer' )
   (( $#_lp_alias_cache )) || unset _lp_alias_cache
 fi