about summary refs log tree commit diff
path: root/Completion/BSD
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-03-01 20:21:59 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-03-01 20:21:59 +0000
commit6a015133bd937c3cd72cde32e35fb1baae4debd6 (patch)
tree7f6a4d83ca462ac42a3f81c5f2091c4cc3338482 /Completion/BSD
parent6e50d3d7dbed4adb01f71de823dda2a6ee5442f3 (diff)
downloadzsh-6a015133bd937c3cd72cde32e35fb1baae4debd6.tar.gz
zsh-6a015133bd937c3cd72cde32e35fb1baae4debd6.tar.xz
zsh-6a015133bd937c3cd72cde32e35fb1baae4debd6.zip
Baptiste: 28819: FreeBSD completion tweaks
Diffstat (limited to 'Completion/BSD')
-rw-r--r--Completion/BSD/Command/.distfiles1
-rw-r--r--Completion/BSD/Command/_sockstat23
2 files changed, 24 insertions, 0 deletions
diff --git a/Completion/BSD/Command/.distfiles b/Completion/BSD/Command/.distfiles
index 86530b8ea..d08edf814 100644
--- a/Completion/BSD/Command/.distfiles
+++ b/Completion/BSD/Command/.distfiles
@@ -15,4 +15,5 @@ _portmaster
 _portsnap
 _powerd
 _procstat
+_sockstat
 '
diff --git a/Completion/BSD/Command/_sockstat b/Completion/BSD/Command/_sockstat
new file mode 100644
index 000000000..2acbe6bec
--- /dev/null
+++ b/Completion/BSD/Command/_sockstat
@@ -0,0 +1,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))'