zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: Update _bind_addresses to work with new ifconfig output (and old).
Date: Sat, 10 Dec 2011 20:32:52 +0100	[thread overview]
Message-ID: <1323545572-10775-1-git-send-email-mikachu@gmail.com> (raw)

I updated net-tools just before sending out the ssh patches and couldn't
quite work out why the -L and -R completions didn't work anymore, turns
out the ifconfig output changed from

eth0      Link encap:Ethernet  HWaddr xx:xx
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0

to

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500  metric 1
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255

This patch changes the pattern to work with either output format by
checking for the inet keyword instead of addr.

---
 Completion/Unix/Type/_bind_addresses |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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
-- 
1.7.5.4


             reply	other threads:[~2011-12-10 19:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 19:32 Mikael Magnusson [this message]
2011-12-10 20:14 ` Danek Duvall
2011-12-10 20:26   ` Mikael Magnusson
2011-12-10 22:18     ` Danek Duvall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1323545572-10775-1-git-send-email-mikachu@gmail.com \
    --to=mikachu@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).