about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2006-10-03 16:20:24 +0000
committerClint Adams <clint@users.sourceforge.net>2006-10-03 16:20:24 +0000
commit39a2fe325bdae1da860cdb39a7b349c37ed4f3df (patch)
tree1f151f7a170028bde4f42d41f86219ab9e1b15fd /Completion
parent4b65fe8966b2caffea5b1efedf078d897d0eb638 (diff)
downloadzsh-39a2fe325bdae1da860cdb39a7b349c37ed4f3df.tar.gz
zsh-39a2fe325bdae1da860cdb39a7b349c37ed4f3df.tar.xz
zsh-39a2fe325bdae1da860cdb39a7b349c37ed4f3df.zip
22811: helper function to give local IP addresses to which a program might bind a socket.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Type/_bind_addresses15
1 files changed, 15 insertions, 0 deletions
diff --git a/Completion/Unix/Type/_bind_addresses b/Completion/Unix/Type/_bind_addresses
new file mode 100644
index 000000000..606de3ffb
--- /dev/null
+++ b/Completion/Unix/Type/_bind_addresses
@@ -0,0 +1,15 @@
+#autoload
+
+local expl
+
+case $OSTYPE in
+  aix*) _hosts "$@" ;;
+  darwin*|freebsd*|dragonfly*) _hosts "$@" ;;
+  irix*) _hosts "$@" ;;
+  # Couldn't find anything special for linux except for /proc/net/dev
+  # Is there any proc file which gives the formatted ip?
+  linux*) ;&
+  *)
+    _wanted bind-addresses expl 'bind address' compadd "$@" - \
+      ${${${(M)${(f)"$(ifconfig -a)"}:#*addr:*}##*addr:}%% *}
+esac