3 local expl list intf sep
8 intf=( ${(f)"$(lsdev -C -c if -F 'name:description')"} )
9 if zstyle -T ":completion:${curcontext}" verbose; then
10 zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
11 zformat -a list " $sep " "$intf[@]"
15 darwin*|freebsd*|dragonfly*) intf=( $(ifconfig -l) ) ;;
16 irix*) intf=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;;
19 # Make sure ifconfig is in the path.
22 intf=( $(ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p') )
23 if [[ ${#intf} -eq 0 && -d /proc/sys/net/ipv4/conf ]]; then
24 # On linux we used to use the following as the default.
25 # However, we now use ifconfig since it finds additional devices such
26 # as tunnels. So only do this if that didn't work.
27 intf=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) )
32 _wanted interfaces expl 'network interface' \
33 compadd "$@" "$disp[@]" - "${(@)intf%%:*}"