From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3777 invoked by alias); 10 Dec 2011 20:27:02 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29992 Received: (qmail 11433 invoked from network); 10 Dec 2011 20:26:51 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=WUqalZoFDqWp1q3jETaIZKF2mTX7hDaBBPAfmqZ1VgI=; b=HBQ0u2l+xfn7UCTLfl03dumopN/f95ngHarFM+ktchLxkQxLvu53Ix4eMe2XHtNdMF 5a+cmbiSLWNbdTouugvuPhgPKf0nJFv+V+7v+/4dIR/xwLjV9UwQSG/VXEbZBmu1El3h f5G4Todx1wCYz5/CuvmJhE/Zm+lAv1rKDTlXY= MIME-Version: 1.0 In-Reply-To: <20111210201454.GD3736@lorien.comfychair.org> References: <1323545572-10775-1-git-send-email-mikachu@gmail.com> <20111210201454.GD3736@lorien.comfychair.org> Date: Sat, 10 Dec 2011 21:26:46 +0100 Message-ID: Subject: Re: PATCH: Update _bind_addresses to work with new ifconfig output (and old). From: Mikael Magnusson To: Danek Duvall , zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 10 December 2011 21:14, Danek Duvall wrote: > On Sat, Dec 10, 2011 at 08:32:52PM +0100, Mikael Magnusson wrote: > >> diff --git a/Completion/Unix/Type/_bind_addresses b/Completion/Unix/Type/_bind_addresses >> index 606de3f..cbe7be2 100644 >> --- a/Completion/Unix/Type/_bind_addresses >> +++ b/Completion/Unix/Type/_bind_addresses >> @@ -11,5 +11,5 @@ case $OSTYPE in >> linux*) ;& >> *) >> _wanted bind-addresses expl 'bind address' compadd "$@" - \ >> - ${${${(M)${(f)"$(ifconfig -a)"}:#*addr:*}##*addr:}%% *} >> + ${${${(M)${(f)"$(ifconfig -a)"}:#*inet*}##*inet (addr:)(#c0,1)}%% *} >> esac > > If you put a space after "inet" and before the star, it'll work when you > have ipv6 addresses (at least on Solaris, whose ifconfig has the new output > you show). Otherwise, you get "inet6" as a completion, which is a bit > silly. Of course, you don't get the actual ipv6 addresses, but that's > probably not a big priority yet. Thanks, I've updated the patch. Does it complete ipv6 addresses if you add 6(#c0,1) after the second inet instead? ${${${(M)${(f)"$(ifconfig -a)"}:#*inet*}##*inet6(#c0,1) (addr:)(#c0,1)}%% *} But maybe if it's an inet6 it should also be surrounded by [], I'm not super familiar with ipv6 and what programs expect since I don't use it. At least ssh(1) mentions that you can do so in the contexts that this completer is used in from _ssh. I do have access to a host with ipv6 addresses, and those have a /64 or so without a space at the end too, I guess that would have to be removed too then. Is it the same with the new output? (That host has the old output). -- Mikael Magnusson