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

[PATCH] Include IPv6 addresses in _bind_addresses results



For IPv6 addresses, ifconfig places a space between "addr:" and the
actual address unlike with IPv4 addresses where the address comes
immediately after the colon.  Remove that space when removing the
"addr:" portion so that the actual address doesn't get removed in the
next step where everything after the first space is removed to eliminate
other information.  Also remove everything after the slash character,
since IPv6 output includes the netmask.

Example output:

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
---
 Completion/Unix/Type/_bind_addresses |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Completion/Unix/Type/_bind_addresses b/Completion/Unix/Type/_bind_addresses
index 606de3f..3460b79 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)"}:#*addr:*}##*addr:( |)}%%(/| )*}
 esac
-- 
1.7.10.4



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