Package: zsh
Version: 4.3.2-17
Severity: wishlist
Tags: patch

Hi!

Many programs accept as a command-line argument, an option to
specify the address to bind as. Completion functions have either not
been offering completion for the same, or have gone for the much
wider set of _hosts.

I am enclosing a file for a new _bind_addresses function which
completes bind-able addresses got by parsing ifconfig output. I know
the required commands only for Linux, and hence I have defaulted to
_hosts for other systems. Well, something better than nothing! :)

#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
I am also enclosing a patch for some of the completion functions for
using this function. (I just did a `grep -ri bind *` over the
Completion directory to get possible functions, there may be more)
Apply this patch after the _bittornado cleanup patch in Bug#390048
(Mixed up descriptions in bittorrent completion).

diff -Naur Unix.orig/_bittorrent Unix/_bittorrent
--- Unix.orig/_bittorrent	2006-09-29 02:59:21.357054312 +0530
+++ Unix/_bittorrent	2006-09-29 02:59:27.886061752 +0530
@@ -24,7 +24,7 @@
       '(--responsefile)--responsefile+[specify file for server response]:file:_files -g "*"'\
       "--url+[specify URL of torrent file]:URL:_urls"\
       '(-i --ip)'{-i+,--ip+}'[specify ip address to report as]:ip address'\
-      "--bind+[specify ip to bind to instead of default]:ip:"\
+      "--bind+[specify ip to bind to instead of default]:ip:_bind_addresses"\
       "--minport+[specify minimum port to listen to]:port:"\
       "--maxport+[specify maximum port to listen to]:port:"\
       "--saveas+[specify file to save to]:file:_files -/"\
@@ -83,7 +83,7 @@
     _arguments -s -S \
       "--port+[specify port to listen on]:port number:" \
       "--dfile+[specify file to store recent downloader info]:file:_files" \
-      "--bind+[specify ip to bind to]:bind address:" \
+      "--bind+[specify ip to bind to]:bind address:_bind_addresses" \
       "--socket_timeout+[specify timeout for closing connections]:timeout (s):"\
       "--save_dfile_interval+[specify interval between saving dfile]:time (s):"\
       "--timeout_downloaders_interval+[timeout for expiring downloaders]:time (s):" \
diff -Naur Unix.orig/_rsync Unix/_rsync
--- Unix.orig/_rsync	2006-09-29 01:48:16.000000000 +0530
+++ Unix/_rsync	2006-09-29 02:40:56.938951384 +0530
@@ -94,7 +94,7 @@
   {--no-v,--no-verbose}'[turn off --verbose]' \
   '--bwlimit=[limit I/O bandwidth]:KBytes per second' \
   '--port=[specify alternate port number]:port:(873)' \
-  '--address=[bind to the specified address]:address:_hosts' \
+  '--address=[bind to the specified address]:bind address:_bind_addresses' \
   '(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \
   '--sockopts=[specify custom TCP options]' \
   '(-4 -6 --ipv4 --ipv6)'{-4,--ipv4}'[prefer IPv4]' \
diff -Naur Unix.orig/_ssh Unix/_ssh
--- Unix.orig/_ssh	2006-09-29 01:48:13.000000000 +0530
+++ Unix/_ssh	2006-09-29 02:42:31.145629792 +0530
@@ -54,7 +54,7 @@
     _arguments -C -s \
       '(-A)-a[disable forwarding of authentication agent connection]' \
       '(-a)-A[enables forwarding of the authentication agent connection]' \
-      '(-P)-b+[specify interface to transmit on]:bind address' \
+      '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \
       '-D+[specify a dynamic port forwarding]:port' \
       '-e+[set escape character]:escape character (or `none'"'"'):' \
       '(-n)-f[go to background]' \
diff -Naur Unix.orig/_wget Unix/_wget
--- Unix.orig/_wget	2006-09-29 01:48:33.000000000 +0530
+++ Unix/_wget	2006-09-29 02:51:52.523287416 +0530
@@ -35,7 +35,7 @@
   '(--proxy -Y --no-proxy)'{--proxy=,-Y+}'[explicitly turn on proxy]' \
   '(--proxy -Y --no-proxy)--no-proxy[explicitly turn off proxy]' \
   '(--quota -Q)'{--quota=,-Q+}'[set retrieval quota]:number' \
-  '--bind-address=:address to bind to (hostname or IP):_hosts' \
+  '--bind-address=[specify address to bind to (hostname or IP)]:bind address:_bind_addresses' \
   '--limit-rate=[specify limit to download rate]:download rate limit' \
   '--no-dns-cache[disable caching DNS lookups]' \
   '--restrict-file-names=[restrict chars in file names to ones OS allows]:OS:->restrict' \
Regards,
Ramkumar.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (101, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.16-beyond2
Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8)

Versions of packages zsh depends on:
ii  debconf [debconf-2.0]        1.5.4       Debian configuration management sy
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libncurses5                  5.5-3       Shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libcap1                       1:1.10-14  support for getting/setting POSIX.
ii  libpcre3                      6.4-2      Perl 5 Compatible Regular Expressi

-- no debconf information

-- 
WARN_(accel)("msg null; should hang here to be win compatible\n");
                                   -- WINE source code

Reply via email to