From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12122 invoked from network); 12 Mar 2000 15:25:37 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Mar 2000 15:25:37 -0000 Received: (qmail 21034 invoked by alias); 12 Mar 2000 15:25:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10088 Received: (qmail 21026 invoked from network); 12 Mar 2000 15:25:30 -0000 Message-ID: <38CBB634.816D2213@u.genie.co.uk> Date: Sun, 12 Mar 2000 15:22:28 +0000 From: Oliver Kiddle X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: Zsh workers Subject: PATCH: _groups and _condition Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit When completing groups, just checking that the ypcat command exists is not a reliable way of determining if YP is being used: it exists here but isn't used. This patch to _groups, makes it also check the exit code from ypcat (which fails here). There may be better ways of determining if NIS is being used. Doesn't it use something like '+:+' as the last line of /etc/passwd? Also here, is a patch against _condition so that it completes only files after more of its options. Incidentally, I had a look at whether it would be possible to add a completion for test and, more specifically, the '[' builtin. Putting [ or \[ after #compdef doesn't work. I can't use '[' as a key to an associative array if I use an assignment like: foo[\[]=whatever though it works fine if I do: a='[';foo[$a]=whatever or use an array style assignment. Oliver Kiddle --- Completion/User/_groups.bak Thu Feb 17 17:52:19 2000 +++ Completion/User/_groups Sun Mar 12 07:18:55 2000 @@ -1,13 +1,13 @@ #compdef newgrp -local expl groups +local expl groups tmp _wanted groups expl group || return 1 if ! zstyle -a ":completion:${curcontext}:" groups groups; then (( $+_cache_groups )) || - if (( ${+commands[ypcat]} )); then - : ${(A)_cache_groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use YP + if (( ${+commands[ypcat]} )) && tmp=$(ypcat group.byname); then + : ${(A)_cache_groups:=${${(f)tmp}%%:*}} # If you use YP else : ${(A)_cache_groups:=${${(s: :)$(