5 intf=$(iwconfig |& egrep 'IEEE 802.11[abg]' | cut -d' ' -f1 | tr ' ' \\n )
6 # intf=$( fgrep ': ' < /proc/net/wireless | cut -d: -f1 | tr \\n ' ' | tr -s " \t" )
7 _wanted interfaces expl 'wireless network interface' \
16 done <<(iwlist scanning 2>/dev/null | grep ESSID | sed -e s/'.*"\(.*\)"'/'\1'/ )
17 _wanted -x names expl 'network name' \
18 compadd off any on ${networks}
21 local curcontext="$curcontext" state line expl ret=1
24 '(1 * -)--help[display help information]' \
25 '(1 * -)--version[display version information]' \
26 '1:network interface:_wlan_interfaces' \
27 '*:parameter:->parameters' && ret=0
29 if [[ -n "$state" ]]; then
32 case $words[CURRENT-1] in
33 essid) _wlan_networks;;
34 nwid|domain) _message -e ids 'network id' ;;
35 freq|channel) _message -e channels 'channel or frequency' ;;
36 sens) _message -e levels 'signal level' ;;
38 _wanted modes expl 'operating mode' compadd \
39 Ad-Hoc Managed Master Repeater Secondary Monitor Auto
41 ap) _message -e access-points 'access point' ;;
42 nick*) _message -e names 'nickname' ;;
43 rate|bit*) _message -e bit-rates 'bit rate' ;;
44 rts*|frag*) _message -e sizes 'size' ;;
45 key|enc*) _message -e keys 'key' ;;
48 \*{min,max}'[modifier]'
49 '*off[disable power management]'
50 '*on[enable power management]'
51 '*all[receive all packets]'
52 'unicast[receive unicast packets only]'
53 'multicast[receive multicast and broadcast packets only]'
57 _values -S ' ' -w 'parameter' \
58 'period[set the period between wake ups]' \
59 'timeout[set timeout before sleep]' \
62 period|timeout) _message -e timeouts 'timeout' ;;
63 txpower) _message -e power 'transmit power' ;;
64 retry) _message -e retries 'retries' ;;
66 _values -S ' ' -w 'option' \
67 'essid[set the network name]' \
68 '(nwid domain)'{nwid,domain}'[set the network ID]' \
69 '(freq channel)'{freq,channel}'[set the operating frequency or channel]' \
70 'sens[set the sensitivity threhold]' \
71 'mode[set operating mode]' \
72 'ap[register with given access point]' \
73 '(nick nickname)'nick{,name}'[set the nickname]' \
74 '(rate bit)'{rate,bit}'[set the bitrate]' \
75 'rts[set packet size threshold for sending RTS]' \
76 'frag[set maximum packet fragment size]' \
77 \*{key,enc}'[add encryption key]' \
78 '*power[manipulate power management scheme parameters]' \
79 'txpower[set transmit power]' \
80 'retry[set number of retries]' \
81 'commit[apply changes imediately]' && ret=0