Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Update _bind_addresses to work with new ifconfig output (and old).



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



Messages sorted by: Reverse Date, Date, Thread, Author