blob: 2acbe6bec3513dd076d56a84be59f46711ca42f2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#compdef sockstat
local tmp_proto protocols proto
tmp_proto=(${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}})
for proto ($tmp_proto) {
case $proto in
*\#*)
protocols=($protocols ${${(j: :)${=proto}}// *\# /:})
;;
*)
protocols=($protocols ${${(j: :)${=proto}}// */})
esac
}
_arguments -s \
'-4[Show AF_INET (IPv4) sockets]' \
'-6[Show AF_INET6 (IPv6) sockets]' \
'-c[Show connected sockets]' \
'-l[Show listening sockets]' \
'-u[Show AF_LOCAL (UNIX) sockets]' \
'-p[Only show Internet sockets if the port number is on the specified list]' \
'-P[Only show sockets of the specified protocols]:protocols:(($protocols))'
|