summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2015-05-03 16:53:47 +0200
committerOliver Kiddle <opk@zsh.org>2015-05-03 16:53:57 +0200
commitab7ec8d9851fea8230e1ccfba284c5bfaf457d88 (patch)
tree837b14c838b96728ebdb530eb20d35737ef8419b /Completion/Unix/Command
parentb29278c69a67089ba225a98478069eb3f32ab4e6 (diff)
downloadzsh-ab7ec8d9851fea8230e1ccfba284c5bfaf457d88.tar.gz
zsh-ab7ec8d9851fea8230e1ccfba284c5bfaf457d88.tar.xz
zsh-ab7ec8d9851fea8230e1ccfba284c5bfaf457d88.zip
35011: update completions for some common Unix commands,
in particular improving FreeBSD support
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_chmod46
-rw-r--r--Completion/Unix/Command/_chown19
-rw-r--r--Completion/Unix/Command/_cmp33
-rw-r--r--Completion/Unix/Command/_comm17
-rw-r--r--Completion/Unix/Command/_cp73
-rw-r--r--Completion/Unix/Command/_cut78
-rw-r--r--Completion/Unix/Command/_date23
-rw-r--r--Completion/Unix/Command/_du75
-rw-r--r--Completion/Unix/Command/_elfdump47
-rw-r--r--Completion/Unix/Command/_find201
-rw-r--r--Completion/Unix/Command/_fuser94
-rw-r--r--Completion/Unix/Command/_gcore50
-rw-r--r--Completion/Unix/Command/_grep2
-rw-r--r--Completion/Unix/Command/_iconv29
-rw-r--r--Completion/Unix/Command/_id60
-rw-r--r--Completion/Unix/Command/_join46
-rw-r--r--Completion/Unix/Command/_last66
-rw-r--r--Completion/Unix/Command/_ldd41
-rw-r--r--Completion/Unix/Command/_ls44
-rw-r--r--Completion/Unix/Command/_md5sum5
-rw-r--r--Completion/Unix/Command/_mkdir66
-rw-r--r--Completion/Unix/Command/_nl40
-rw-r--r--Completion/Unix/Command/_nm49
-rw-r--r--Completion/Unix/Command/_od23
-rw-r--r--Completion/Unix/Command/_patch4
-rw-r--r--Completion/Unix/Command/_ping34
-rw-r--r--Completion/Unix/Command/_ps188
-rw-r--r--Completion/Unix/Command/_readelf62
-rw-r--r--Completion/Unix/Command/_rm15
-rw-r--r--Completion/Unix/Command/_sed42
-rw-r--r--Completion/Unix/Command/_sort107
-rw-r--r--Completion/Unix/Command/_uname116
-rw-r--r--Completion/Unix/Command/_uniq4
-rw-r--r--Completion/Unix/Command/_wc26
-rw-r--r--Completion/Unix/Command/_xargs74
35 files changed, 1378 insertions, 521 deletions
diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod
index 48ce050e4..85e6df1ae 100644
--- a/Completion/Unix/Command/_chmod
+++ b/Completion/Unix/Command/_chmod
@@ -1,34 +1,52 @@
-#compdef chmod
+#compdef chmod gchmod
 
 local curcontext="$curcontext" state line expl ret=1
 local -a args privs
 
-args=( '*:file:->files' )
-(( $+words[(r)--reference*] )) || args+=( '1:mode:->mode' )
+args=( '*:file:->files' '1:mode:->mode' )
 
 if _pick_variant gnu=Free\ Soft unix --version; then
   args+=(
     '(-v --verbose -c --changes)'{-c,--changes}'[report changes made]'
     '(-v --verbose -c --changes)'{-v,--verbose}'[output a diagnostic for every file processed]'
     '(-f --silent --quiet)'{-f,--silent,--quiet}'[suppress most error messages]'
-    '--reference=[copy permissions of specified file]:file:_files'
+    '(--no-preserve-root)--preserve-root[fail to operate recursively on /]'
+    "(--preserve-root)--no-preserve-root[don't treat / specially (default)]"
+    '(1)--reference=[copy permissions of specified file]:file:_files'
     '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]'
     '(- : *)--help[display help information]'
     '(- : *)--version[display version information]'
   )
-  privs=(
-    'X[execute only if executable to another]'
-    "u[owner's current permissions]"
-    "g[group's current permissions]"
-    "o[other's current permissions]"
-  )
 else
-  # based on $OSTYPE = solaris2.8
   args+=(
     '-f[suppress most error messages]'
     '-R[change files and directories recursively]'
   )
-  privs=( 'l[mandatory locking]' )
+  case $OSTYPE in
+    freebsd*|dragonfly*|darwin*)
+      args+=( '-v[output a diagnostic for every file processed]')
+    ;|
+    freebsd*|netbsd*|darwin*|dragonfly*)
+      args+=( "-h[operate on symlinks them self]" )
+    ;|
+    freebsd*|openbsd*|netbsd*|darwin*|dragonfly*)
+      args+=(
+	'(-H -L -P)-L[follow all symlinks]'
+	'(-H -L -P)-H[follow symlinks on the command line]'
+	'(-H -L -P)-P[do not follow symlinks (default)]'
+      )
+    ;|
+    darwin*)
+      args+=(
+        '(1)-C[returns false if any of the named files have ACLs]'
+	'(1)-N[remove ACLs from specified files]'
+	'(1)-E[read ACL info from stdin as a sequential list of ACEs]'
+	'(1)-i[removes inherited bit from all entries in named files ACLs]'
+        '(1)-I[removes all inherited entries from named files ACLs]'
+      )
+    ;;
+    solaris*) privs=( 'l[mandatory locking]' ) ;;
+  esac
 fi
 
 _arguments -C -s "$args[@]" && ret=0
@@ -43,6 +61,10 @@ case "$state" in
       _values -S '' privilege \
 	'r[read]' 'w[write]' 'x[execute]' \
 	's[set uid/gid]' 't[sticky]' \
+	'X[execute only if directory or executable to another]' \
+	"u[owner's current permissions]" \
+	"g[group's current permissions]" \
+	"o[other's current permissions]" \
 	"$privs[@]" && ret=0
     else
       suf=( -S '' )
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index 71c21da32..641b5a773 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -1,29 +1,42 @@
 #compdef chown chgrp zf_chown=chown zf_chgrp=chgrp
 
 local curcontext="$curcontext" state line expl ret=1
-local suf usr grp req deref args
+local suf usr grp req deref pattern arg args
 
 if _pick_variant gnu=Free\ Soft unix --version; then
   args=(
     '(-c --changes -v --verbose)'{-c,--changes}'[report each change made]'
     '(-c --changes -v --verbose)'{-v,--verbose}'[output info for every file processed]'
     '(-h --no-dereference)--dereference[dereference symlinks]'
-    '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks them self]'
+    '(-h --no-dereference --dereference)'{-h,--no-dereference}'[operate on symlinks themselves]'
     '(-f --silent --quiet)'{-f,--silent,--quiet}"[don't report errors]"
+    '--preserve-root[fail to operate recursively on /]'
     '--reference=[copy ownership of specified file]:file:_files'
     '(-R --recursive)'{-R,--recursive}'[change files and directories recursively]'
+    '(-H -L -P)-L[follow all symlinks]'
+    '(-H -L -P)-H[follow symlinks on the command line]'
+    '(-H -L -P)-P[do not follow symlinks (default)]'
     '(- : *)--help[display help information]'
     '(- : *)--version[display version information]'
   )    
   [[ $service = chown ]] &&
       args+=( '--from=[restrict changes to files by current ownership]: :->owner' )
 else
-  # based on $OSTYPE = solaris2.8
   args=(
     "-f[don't report errors]"
     "-h[operate on symlinks them self]"
     '-R[change files and directories recursively]'
+    '(-H -L -P)-L[follow all symlinks]'
+    '(-H -L -P)-H[follow symlinks on the command line]'
+    '(-H -L -P)-P[do not follow symlinks (default)]'
   )
+  for pattern arg in \
+    'freebsd*' "-x[don't traverse file systems]" \
+    '(darwin|dragonfly|(free|net)bsd)*' '-v[output info for every file processed]' \
+    'solaris2.<11->' '-s[owner and/or group are Windows SID strings]'
+  do
+    [[ $OSTYPE = $~pattern ]] && args+=( $arg )
+  done
 fi
 
 (( $+words[(r)--reference*] )) || args+=( '(--reference)1: :->owner' )
diff --git a/Completion/Unix/Command/_cmp b/Completion/Unix/Command/_cmp
new file mode 100644
index 000000000..bcede8b0b
--- /dev/null
+++ b/Completion/Unix/Command/_cmp
@@ -0,0 +1,33 @@
+#compdef cmp gcmp
+
+local args variant
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+
+case $variant in
+  gnu)
+    args=(
+      '(-b --print-bytes)'{-b,--print-bytes}'[print differing bytes]'
+      '(-i --ignore-initial)'{-i+,--ignore-initial}'[skip specified number of bytes]:bytes'
+      '(-l --verbose -s --silent --quiet)'{-l,--verbose}'[output all differences]'
+      '(-n --bytes)'{-n+,--bytes=}'[specify maximum bytes to compare]:bytes'
+      '(-s --quiet --silent -l --verbose)'{-s,--quiet,--silent}'[return status alone signifies differences]'
+      '(- *)'{-v,--version}'[display version information]'
+      '(- *)--help[display help information]'
+    )
+  ;;
+  freebsd*|openbsd*)
+    args=(
+      "-h[don't follow symbolic links]"
+      '-x[hexadecimal output and zero based offset index]'
+      '-z[compare file sizes first]'
+    )
+  ;&
+  *)
+    args+=(
+      '(-s)-l[output all differences]'
+      '(-l)-s[silent: return status alone signifies differences]'
+    )
+  ;;
+esac
+
+_arguments -s $args '1:file 1:_files' '2:file 2:_files' '::byte offset' '::byte offset'
diff --git a/Completion/Unix/Command/_comm b/Completion/Unix/Command/_comm
index e90c317f6..d1d835f6a 100644
--- a/Completion/Unix/Command/_comm
+++ b/Completion/Unix/Command/_comm
@@ -1,20 +1,27 @@
-#compdef comm
+#compdef comm gcomm
 
 local -a args
 
 args=(
-  '-1[suppress lines unique to FILE1]'
-  '-2[suppress lines unique to FILE2]'
+  '-1[suppress lines unique to first file]'
+  '-2[suppress lines unique to second file]'
   '-3[suppress lines that appear in both files]'
-  '1:file1 to compare:_files'
-  '2:file2 to compare:_files'
+  '1:file to compare:_files'
+  '2:file to compare:_files'
 )
 
 if _pick_variant gnu=GNU unix --version; then
   args+=(
+    '(--nocheck-order)--check-order[check input is correctly sorted]'
+    "(--check-order)--nocheck-order[don't check input is correctly sorted]"
+    '--output-delimiter=:delimiter'
     '(- : *)--version[display version information]'
     '(- : *)--help[display help information]'
   )
+elif [[ $OSTYPE = (freebsd|dragonfly|darwin)* ]]; then
+  args+=( '-i[case insensitive comparison of lines]' )
+elif [[ $OSTYPE = (openbsd|netbsd)* ]]; then
+  args+=( '-f[case insensitive comparison of lines]' )
 fi
 
 _arguments -s $args
diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp
index 70ab0858e..4c4dea2e9 100644
--- a/Completion/Unix/Command/_cp
+++ b/Completion/Unix/Command/_cp
@@ -1,22 +1,23 @@
-#compdef cp
+#compdef cp gcp
 
 if _pick_variant gnu=GNU unix --version; then
   _arguments -s -S \
-    '(-a --archive)'{-a,--archive}'[same as -dR --preserve=all]' \
+    '(-a --archive)'{-a,--archive}'[archive mode, same as -dR --preserve=all]' \
+    "--attributes-only[don't copy file data, just attributes]" \
     '(-b --backup)-b[backup]' \
-    '(-b --backup)--backup=[backup]:method:(none off numbered t existing nil simple never)' \
+    '(-b --backup)--backup=-[backup each destination file]::method:(none off numbered t existing nil simple never)' \
     '--copy-contents[copy contents of special files when recursive]' \
     '-d[same as --no-dereference --preserve=links]' \
     '(-f --force)'{-f,--force}'[remove and retry for destinations that cannot be opened]' \
-    '(-i --interactive)'{-i,--interactive}'[prompt before overwrite]' \
+    '(-i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwrite]' \
     '-H[follow command-line symbolic links]' \
     '(-l --link)'{-l,--link}'[link files instead of copying]' \
     '(-L --dereference)'{-L,--dereference}'[always follow symbolic links]' \
-    '(-n --no-clobber)'{-n,--no-clobber}'[do not overwrite an existing file]' \
+    (-n --no-clobber -i --interactive){-n,--no-clobber}"[don't overwrite an existing file]" \
     '(-P --no-dereference)'{-P,--no-dereference}'[never follow symbolic links]' \
     '-p[same as --preserve=mode,ownership,timestamps]' \
-    '--preserve=[preserve specified attributes]:attributes to preserve:_values -s , mode timestamps ownership links context xattr all' \
-    '--no-preserve=[don'\''t preserve specified attributes]:attributes not to preserve:_values -s , mode timestamps ownership links context xattr all' \
+    '--preserve=-[preserve specified attributes]:: :_values -s , attribute mode timestamps ownership links context xattr all' \
+    "--no-preserve=[don't preserve specified attributes]: :_values -s , attribute mode timestamps ownership links context xattr all" \
     '--parents[append source path to target directory]' \
     '(-R -r --recursive)'{-R,-r,--recursive}'[copy directories recursively]' \
     '--reflink=-[control clone/CoW copies]::when to perform a lightweight copy:(always auto)' \
@@ -24,39 +25,41 @@ if _pick_variant gnu=GNU unix --version; then
     '--sparse=[control creation of sparse files]:when to create sparse files:(auto always never)' \
     '--strip-trailing-slashes[remove any trailing slashes from each source argument]' \
     '(-s --symbolic-link)'{-s,--symbolic-link}'[make symbolic links instead of copies of non-directories]' \
-    '(-S --suffix)'{-S,--suffix=}'[override the usual backup suffix]:backup suffix:' \
-    '(-t --target-directory)'{-t,--target-directory=}'[copy all source arguments into target directory]:target directory:_files -/' \
+    '(-S --suffix)'{-S+,--suffix=}'[override the usual backup suffix]:backup suffix' \
+    '(-t --target-directory)'{-t+,--target-directory=}'[copy all source arguments into target directory]:target directory:_files -/' \
     '(-T --no-target-directory)'{-T,--no-target-directory}'[treat DEST as a normal file]' \
     '(-u --update)'{-u,--update}'[copy only when source is newer than destination or destination is missing]' \
     '(-v --verbose)'{-v,--verbose}'[explain what is being done]' \
     '(-x --one-file-system)'{-x,--one-file-system}'[stay on this file system]' \
-    '--help' \
-    '--version' \
+    '(--context)-Z[set destination SELinux security context]' \
+    '(-Z)--context=-[set destination SELinux security context]::context' \
+    '(- *)--help' '(- *)--version' \
     '*:file or directory:_files'
-
-elif [[ "$OSTYPE" == darwin* ]]; then
-  _arguments -s -S \
-    '-R[copy directories recursively]' \
-    '(-L -P)-H[with -R, follow symlinks on the command line]' \
-    '(-H -P)-L[with -R, follow all symlinks]' \
-    '(-H -L)-P[with -R, do not follow symlinks (default)]' \
-    '(-i -n)-f[force overwriting existing file]' \
-    '(-f -n)-i[confirm before overwriting existing file]' \
-    '(-f -i)-n[do not overwrite existing file]' \
-    '-a[same as -pRP]' \
-    '-p[preserve timestamps, mode, owner, flags, ACLs, and Extended Attributes]' \
-    '-v[show file names as they are copied]' \
-    '-X[do not copy Extended Attributes or resource forks]' \
-    '(-)*:file or directory:_files'
-
-else    # assume POSIX
-  _arguments -s -S \
+else
+  local pattern arg args
+  args=(
+    '(-L -P)-H[follow symlinks on the command line in recursive mode]'
+    '(-H -P)-L[follow all symlinks in recursive mode]'
+    '(-H -L)-P[do not follow symlinks in recursive mode (default)]'
+    '(-i -n)-f[force overwriting existing file]'
+    '(-f -n)-i[confirm before overwriting existing file]'
+    '-p[preserve timestamps, mode, owner, flags, ACLs, and extended attributes]'
     '-R[copy directories recursively]' \
-    '(-L -P)-H[with -R, follow symlinks on the command line]' \
-    '(-H -P)-L[with -R, follow all symlinks]' \
-    '(-H -L)-P[do not follow symlinks]' \
-    '(-i)-f[force overwriting existing file]' \
-    '(-f)-i[confirm before overwriting existing file]' \
-    '-p[preserve timestamps, mode, and owner]' \
     '(-)*:file or directory:_files'
+  )
+  for pattern arg in \
+    '(aix|hpux|irix|solaris)*' '-r[copy directories recursively]' \
+    'solaris2.<9->*' '-@[preserve extended attributes]' \
+    'solaris2.<11->*' '-/[preserve extended attributes and extended system attributes]' \
+    '(darwin|dragonfly|freebsd)*' "(-f -i)-n[don't overwrite existing file]" \
+    'netbsd*' "-N[don't copy file flags]" \
+    '(darwin|dragonfly|freebsd|netbsd)*' '-a[archive mode, same as -RpP]' \
+    '(dragonfly|freebsd)*' '-l[link files instead of copying]' \
+    '(darwin|dragonfly|freebsd|netbsd)*' '-v[show file names as they are copied]' \
+    'darwin*' "-X[don't copy extended attributes or resource forks]" \
+    '(dragonfly|freebsd)*' "-x[don't traverse file systems]"
+  do
+    [[ $OSTYPE = $~pattern ]] && args+=( $arg )
+  done
+  _arguments -s -S $args
 fi
diff --git a/Completion/Unix/Command/_cut b/Completion/Unix/Command/_cut
index 1024c20a7..caf8f32b7 100644
--- a/Completion/Unix/Command/_cut
+++ b/Completion/Unix/Command/_cut
@@ -2,44 +2,41 @@
 
 typeset -A _cut_args
 
-if _pick_variant gnu="Free Soft" unix --version; then
-  case $LANG in
-    (de_DE.UTF-8)
-      _cut_args=(
-	bytes           "nur diese Bytes ausgeben"
-	characters      "nur diese Zeichen ausgeben"
-	delimiter       "Delimiter anstelle von Tabulator als Trenner benutzen"
-	fields          "nur diese Felder und alle Zeilen OHNE Trennzeichen ausgeben"
-	n               "(ignoriert)"
-	complement      $'das Komplement der Menge der gew\u00e4hlten Bytes, Zeichen oder Felder bilden'
-	only-delimited  "keine Zeilen ausgeben, die keinen Trenner enthalten"
-	output-delimiter "Zeichenkette als Ausgabetrennzeichen benutzen"
-	help            "diese Hilfe anzeigen und beenden"
-	version         "Versionsinformation anzeigen und beenden"
-      )
-    ;;
-    (*)
-      _cut_args=(
-	bytes           "select only these bytes"
-	characters      "select only these characters"
-	delimiter       "use DELIM instead of TAB for field delimiter"
-	fields          "select only these fields and lines without the delimiter character"
-	n               "(ignored)"
-	complement      "complement the set of selected bytes, characters or fields"
-	only-delimited  "do not print lines not containing delimiters"
-	output-delimiter "use STRING as the output delimiter"
-	help            "display this help and exit"
-	version         "output version information and exit"
-      )
-    ;;
-  esac
+case $LANG in
+  (de_DE.UTF-8)
+    _cut_args=(
+      bytes           "nur diese Bytes ausgeben"
+      characters      "nur diese Zeichen ausgeben"
+      delimiter       "Delimiter anstelle von Tabulator als Trenner benutzen"
+      fields          "nur diese Felder und alle Zeilen OHNE Trennzeichen ausgeben"
+      complement      $'das Komplement der Menge der gew\u00e4hlten Bytes, Zeichen oder Felder bilden'
+      only-delimited  "keine Zeilen ausgeben, die keinen Trenner enthalten"
+      output-delimiter "Zeichenkette als Ausgabetrennzeichen benutzen"
+      help            "diese Hilfe anzeigen und beenden"
+      version         "Versionsinformation anzeigen und beenden"
+    )
+  ;;
+  (*)
+    _cut_args=(
+      bytes           "select only specified bytes"
+      characters      "select only specified characters"
+      delimiter       "use alternate field delimiter"
+      fields          "select only specified fields"
+      complement      "negate the set of selected bytes, characters or fields"
+      only-delimited  "suppress lines with no delimiters"
+      output-delimiter "use specified string as the output delimiter"
+      help            "display help information"
+      version         "output version information"
+    )
+  ;;
+esac
 
+if _pick_variant gnu="Free Soft" unix --version; then
   _arguments \
     '(--bytes -b)'{--bytes=,-b+}'['$_cut_args[bytes]']:list' \
     '(--characters -c)'{--characters=,-c+}'['$_cut_args[characters]']:list' \
     '(--delimiter -d)'{--delimiter=,-d+}'['$_cut_args[delimiter]']:delimiter' \
     '(--fields -f)'{--fields=,-f+}'['$_cut_args[fields]']:list' \
-    '-n['$_cut_args[n]']' \
     '--complement['$_cut_args[complement]']' \
     '(--only-delimited -s)'{--only-delimited,-s}'['$_cut_args[only-delimited]']' \
     '--output-delimiter=['$_cut_args[output-delimiter]']:delimiter' \
@@ -47,12 +44,15 @@ if _pick_variant gnu="Free Soft" unix --version; then
     '(- *)--version['$_cut_args[version]']' \
     '*:file:_files'
 else
-  _arguments \
-    '-b[list specifies byte positions]:list:' \
-    '-c[list specifies character positions]:list:' \
-    '-d[use alternate delimiter]:delimiter' \
-    '-f[list specifies fields]:list:' \
-    '-n[do not split multi-byte characters]' \
-    '-s[suppress lines with no delimiters]' \
+  case $OSTYPE in
+    freebsd*|dragonfly*) args+=( '(-d)-w[use whitespace as the delimiter]' ) ;;
+  esac
+  _arguments $args \
+    "-b[${_cut_args[bytes]}]:list" \
+    "-c[${_cut_args[characters]}]:list" \
+    "(-w)-d[${_cut_args[delimiter]}]:delimiter" \
+    "-f[${_cut_args[fields]}]:list" \
+    "-n[do not split multi-byte characters]" \
+    "-s[${_cut_args[only-delimited]}]" \
     '*:file:_files'
 fi
diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date
index 7b1d3a7ab..e596ac038 100644
--- a/Completion/Unix/Command/_date
+++ b/Completion/Unix/Command/_date
@@ -1,4 +1,4 @@
-#compdef date
+#compdef date gdate
 
 local -a args
 
@@ -8,7 +8,7 @@ if _pick_variant gnu="Free Software Foundation" unix --version; then
     '-f[output dates specified in file]:file:_files'
     '-I-[iso-8601]:precision:(date hours minutes seconds)'
     '-r[reference]:file:_files'
-    '-R[rfc-2822]'
+    '-R[RFC2822 format]'
     '-s[set]:time string'
     '--rfc-3339=-[output date and time in RFC 3339 format]:output type:(date seconds ns)'
     --
@@ -20,26 +20,23 @@ else
     solaris*)
       args=( '-a:adjustment' )
     ;;
-    freebsd*|darwin*)
+    freebsd*|darwin*|dragonfly*|netbsd*|openbsd*)
       args=(
 	'-n[only set time on current machine]'
 	'-d:daylight saving time value'
 	'-j[do not try to set date]'
-	'-f:parsing format'
 	'-r:seconds since epoch'
 	'-t:minutes west of GMT'
-	'-v:adjustment value'
       )
+    ;|
+    freebsd*) args+=( '-R[RFC2822 format]' ) ;|
+    freebsd*|dragonfly*|darwin*)
+      args+=( '-f:parsing format' '-v:adjustment value' )
     ;;
     openbsd*)
-      args=(
-	'-n[only set time on current machine]'
-	'-d:daylight saving time value'
-	'-a[gradually skew]'
-	'-r:seconds since epoch'
-	'-t:minutes west of GMT'
-      )
-    ;;
+      args+=( '-z[specify timezone for output]:time zone:_time_zone')
+    ;|
+    openbsd*|netbsd*) args=( '-a[gradually skew]' ) ;;
   esac
 fi
 
diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du
index 8b053ba4d..d8871cd8d 100644
--- a/Completion/Unix/Command/_du
+++ b/Completion/Unix/Command/_du
@@ -1,4 +1,4 @@
-#compdef du
+#compdef du gdu
 
 if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
   local context state line expl ret=1
@@ -18,7 +18,7 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
     '(-l --count-links)'{-l,--count-links}'[count sizes many times if hard linked]' \
     '(-L --dereference -H -D --dereference-args -P --no-dereference)'{-L,--dereference}'[dereference all symlinks]' \
     '(-S --separate-dirs)'{-S,--separate-dirs}'[do not include size of subdirectories]' \
-    '(-s --summarize --max-depth -a --all)'{-s,--summarize}'[only display total for each argument]' \
+    '(-s --summarize --max-depth -a --all)'{-s,--summarize}'[only report total for each argument]' \
     '(-x --one-file-system)'{-x,--one-file-system}'[skip directories on different filesystems]' \
     '(-0 --null)'{-0,--null}'[end each output line with NUL instead of newline]' \
     \*{-X+,--exclude-from=}'[exclude files matching any pattern in file]:file:_files' \
@@ -26,17 +26,13 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
     '(-s --summarize)--max-depth=[maximum levels to recurse]:levels' \
     '--files0-from=[use NUL-terminated list of files from file]:file:_files' \
     '--time-style=[show times using given style, +FORMAT for strftime formatted args]:style:->timestyle' \
-    '--time=-[show time of last modification of any file in the directory]:property:->time' \
+    '--time=-[show time of last modification of any file in the directory]:property:(atime access use ctime status)' \
+    '(-t --threshold)'{-t+,--threshold=}'[report only entries for which size exceeds threshold]:threshold' \
     '(* -)--help[display help information]' \
     '(* -)--version[display version information]' \
     '*:file:_files' && ret=0
 
   case $state in
-    (time)
-      local -a property
-      property=(atime access use ctime status)
-      _wanted -C $context property expl property compadd -a property && ret=0
-    ;;
     (timestyle)
       local -a style desc
       style=(full-iso long-iso iso +)
@@ -47,39 +43,36 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
 
   return ret
 
-elif [[ "$OSTYPE" == darwin* ]]; then
-  _arguments -s -A "-*" \
-    '(-H -L -P)-H[follow symlinks on the command line]' \
-    '(-H -L -P)-L[follow all symlinks]' \
-    '(-H -L -P)-P[do not follow symlinks (default)]' \
-    '*-I+[ignore files/directories matching specified mask]:mask' \
-    '(-a -s -d)-a[display entry also for files (not just directories) in file hierarchy]' \
-    '(-a -s -d)-d+[display entry for directories up to specified depth]:depth' \
-    '(-a -s -d)-s[display entry only for files/directories specified on the command line]' \
-    '(-h -k -m -g)-h[human readable output]' \
-    '(-h -k -m -g)-k[use block size of 1K-byte]' \
-    '(-h -k -m -g)-m[use block size of 1M-byte]' \
-    '(-h -k -m -g)-g[use block size of 1G-byte]' \
-    '-c[display grand total]' \
-    '-r[notify about unreadable files/directories]' \
-    '-x[exclude directories on different file systems]' \
-    '*:file:_files'
-
 else
-  # based on $OSTYPE = solaris2.8
+  local pattern arg args
+  args=(
+    '(-a -s -d)-a[report sizes for all files, not just directories]'
+    '(-H -L -P)-L[follow all symlinks]'
+    '(-a -s -d)-s[only report total for each argument]'
+    '(-h -m -g -B)-k[use block size of 1K-byte]'
+    '-r[notify about unreadable files/directories]'
+  )
   local xdev='[skip directories on different filesystems]'
-  if [[ ${commands[$words[1]]:-$words[1]} = *xpg4* ]]; then
-    args=( -x$xdev )
-  else
-    args=( -d$xdev
-      '-L[dereference symlinks]'
-      "(-a)-o[do not add child directories' usage to parent's total]"
-    )
-  fi
-  _arguments -s "$args[@]" \
-    '(-s -o)-a[write counts for all files]' \
-    '-k[use block size of 1k]' \
-    '-r[notify about unreadable files/directories]' \
-    '(-a)-s[only display total for each argument]' \
-    '*:file:_files'
+  for pattern arg in \
+    'freebsd*' '-A[apparent size instead of usage]' \
+    '(darwin*|*bsd*|dragonfly*|solaris2.<10->)' '(-H -L -P)-H[follow symlinks on the command line]' \
+    '(darwin|*bsd|dragonfly)*' '(-H -L -P)-P[do not follow symlinks (default)]' \
+    '(darwin|dragonfly|freebsd)*' '*-I+[ignore files/directories matching specified mask]:mask' \
+    '(darwin|*bsd|dragonfly)*' '(-a -s -d)-d+[display entry for directories up to specified depth]:depth' \
+    '(darwin*|*bsd*|dragonfly*|solaris2.<10->)' '(-k -m -g -B)-h[human readable output]' \
+    'netbsd*' '-i[output inode usage instead of blocks]' \
+    '(darwin*|freebsd*|netbsd*|solaris2.<11->)' '(-h -k -g -B)-m[use block size of 1M-byte]' \
+    '(darwin|freebsd<8->.|netbsd)*' '(-h -k -m -B)-g[use block size of 1G-byte]' \
+    'freebsd*' '(-h -k -m -g)-B[block size]:block size (bytes)' \
+    '(darwin|*bsd|dragonfly)*' '-c[display grand total]' \
+    'freebsd*' '-l[count sizes many times if hard linked]' \
+    '(freebsd|netbsd)*' '-n[ignore files and directories with nodump flag set]' \
+    'solaris*' "(-a)-o[don't add child directories' usage to parent's total]" \
+    'freebsd<8->.*' '-t+[report only entries for which size exceeds threshold]:threshold' \
+    'solaris*' "-d$xdev" \
+    '(darwin|*bsd|dragonfly|solaris)*' "-x$xdev"
+  do
+    [[ $OSTYPE = $~pattern ]] && args+=( $arg )
+  done
+  _arguments -s -A "-*" $args
 fi
diff --git a/Completion/Unix/Command/_elfdump b/Completion/Unix/Command/_elfdump
new file mode 100644
index 000000000..ee92402d2
--- /dev/null
+++ b/Completion/Unix/Command/_elfdump
@@ -0,0 +1,47 @@
+#compdef elfdump
+
+local -a args
+
+_elf_file() {
+  [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]]
+}
+
+args=(
+  '-c[dump section header information]'
+  '-d[dump .dynamic section]'
+  '-e[dump file header]'
+  '-G[dump .got (global offset table) section]'
+  '-h[dump .hash section]'
+  '-i[dump .interp (interpreter) section]'
+  '-n[dump .note sections]'
+  '(-w)-p[dump program headers]'
+  '-r[dump relocation sections]'
+  '-s[dump symbol table sections]'
+  '(-p)-w[write contents of matched sections to file]:file:_files'
+)
+
+case $OSTYPE in
+  solaris*)
+    args+=(
+      '-g[dump .group section]'
+      '-H[dump .SUNW_cap (capabilities) section]'
+      '-m[dump .SUNW_move section]'
+      '-S[dump symbol table sections sorted according to symbol sort sections]'
+      '-u[dump stack unwind/exceptions sections]'
+      '-v[dump .SUNW_version (versioning) sections]'
+      '-y[dump .SUNW_syminfo (symbol bindings) section]'
+      '-I[match sections by index]:index or range'
+      "-N[match sections by name]:section"
+      '-T[match sections by type]:type'
+      '-C[demangle C++ symbol names]'
+      '-k[calculate ELF checksum]'
+      '-l[show long section names without truncation]'
+      '-O[specify osabi to apply]:osabi'
+      '-P[use alternative section header]'
+      "*:elf file:_files -g '*(-.e:_elf_file:)'"
+    )
+  ;;
+  freebsd*) args+=( '-a[dump all information]' ) ;;
+esac
+
+_arguments -s $args
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 33767c080..8f80e36cf 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -1,82 +1,145 @@
-#compdef find
+#compdef find gfind
 
-_arguments \
-  '(- *)-help' '(-)--help' \
-  '(- *)-version' '(-)--version' \
+local variant args
+
+_pick_variant -r variant gnu=GNU $OSTYPE -version
+
+case $variant in
+  solaris*)
+    args+=(
+      '*-'{n,}'cpio:device:_files'
+      '*-local'
+    )
+  ;|
+  solaris*|darwin*)
+    args+=( '*-xattr' )
+  ;|
+  solaris2.<10->|freebsd*|darwin*)
+    args+=( '*-acl' )
+  ;|
+  solaris2.<11->|freebsd*|dragonfly*|darwin*|openbsd*|gnu)
+    args+=(
+      '*-amin:access time (minutes)'
+      '*-cmin:inode change time (minutes)'
+      '*-mmin:modification time (minutes)'
+      '*-iname:name pattern to match (case insensitive)'
+      '*-print0'
+    )
+  ;|
+  netbsd*|freebsd*|dragonfly*|darwin*|gnu)
+    args+=( '(-H -L)-P[never follow symlinks]' )
+  ;|
+  netbsd*|freebsd*|dragonfly*|openbsd*|darwin*|gnu)
+    args+=( '-d[depth first traversal]' )
+  ;|
+  darwin*|freebsd*|gnu)
+    args+=(
+      '*-Bmin:birth time (minutes)'
+      '*-Bnewer:file to compare (birth time):_files'
+      '*-Btime:birth time (hours)'
+    )
+  ;|
+  freebsd*|dragonfly*|darwin*|openbsd*|gnu)
+    args+=(
+      '*-anewer:file to compare (access time):_files'
+      '*-cnewer:file to compare (inode change time):_files'
+      '*-mnewer:file to compare (modification time):_files'
+      '*-maxdepth:maximum search depth'
+      '*-mindepth:minimum search depth'
+      '*-path:path pattern to search:'
+    )
+  ;|
+  freebsd*|dragonfly*|darwin*|gnu)
+    args+=(
+      '*-delete'
+      '*-empty'
+      '*-execdir:program: _command_names -e:*\;::program arguments: _normal'
+      '*-gid:numeric group ID'
+      '*-uid:numeric user ID'
+      '*-noleaf'
+      '*-lname:link pattern to search'
+      '*-ilname:link pattern to search (case insensitive)'
+      '*-ipath:path pattern to search (case insensitive)'
+      '*-regex:regular expression to search'
+      '*-iregex:regular expression to search (case insensitive)'
+      '*-wholename:full path pattern to search' \
+      '*-iwholename:full path pattern to search (case insensitive)'
+      '*-ignore_readdir_race'
+      '*-noignore_readdir_race'
+      '*-okdir:program: _command_names -e:*\;::program arguments: _normal'
+      '*-samefile:file to compare inode:_files' \
+      '*-true'
+      '*-false'
+      '*-and'
+      '*-or'
+      '*-not'
+    )
+  ;|
+  freebsd*|dragonfly*|gnu) args+=( '*-quit' ) ;|
+  netbsd*|freebsd*|dragonfly*|darwin*)
+    args+=(
+      '-E[use extended regular expressions with -regex/-iregex]'
+      '-X[warn if filename contains characters special to xargs]'
+      '-f[specify file hierarchy to traverse]:path:_directories'
+      '-s[traverse directories in sorted order]'
+      "-x[don't span filesystems]"
+      '*-flags:flags:_chflags'
+    )
+  ;|
+  freebsd*|dragonfly*) args+=( '*-sparse' ) ;|
+  darwin*) args+=( '*-xattrname:name' ) ;|
+  gnu)
+    args+=(
+      '(- *)-help' '(-)--help'
+      '(- *)-version' '(-)--version'
+      '-D[print diagnostics]:debug option:(help tree search stat rates opt exec)'
+      '-O+[enable query optimisation]:level:(1 2 3)'
+      '*-daystart'
+      '-regextype:regexp syntax:(emacs posix-awk posix-basic posix-egrep posix-extended)'
+      '*-warn'
+      '*-nowarn'
+      '*-xautofs'
+      '*-used:access after inode change (days)'
+      '*-executable'
+      '*-readable'
+      '*-writable'
+      '*-xtype:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))'
+      '*-fls:output file:_files'
+      '*-fprint:output file:_files'
+      '*-fprint0:output file:_files'
+      '*-fprintf:output file:_files:output format'
+      '*-printf:output format'
+    )
+    [[ $OSTYPE = linux-gnu ]] && args+=( '*-context:SELinux context' )
+  ;;
+esac
+
+_arguments $args \
   '(-L -P)-H[only follow symlinks when resolving command-line arguments]' \
   '(-H -P)-L[follow symlinks]' \
-  '(-H -L)-P[never follow symlinks]' \
-  '-D[print diagnostics]:deb option:(help tree search stat rates opt exec)' \
-  '-O+[enable query optimisation]:level:(1 2 3)' \
-  '*-daystart' \
-  '*-d' '*-depth' \
+  '*-atime:access time (days)' \
+  '*-ctime:inode change time (days)' \
+  '*-depth' \
+  '*-exec:program: _command_names -e:*\;::program arguments: _normal' \
   '*-follow' \
-  '(-noignore_readdir_race)-ignore_readdir_race' \
-  '*-maxdepth:maximum search depth' \
-  '*-mindepth:minimum search depth' \
-  '*-mount' \
-  '(-ignore_readdir_race)-noignore_readdir_race' \
-  '*-noleaf' \
-  '-regextype:regexp syntax:(emacs posix-awk posix-basic posix-egrep posix-extended)' \
-  '*-warn' \
-  '*-nowarn' \
-  '*-xdev' \
-  '*-amin:access time (minutes):' \
-  '*-cmin:inode change time (minutes):' \
-  '*-mmin:modification time (minutes):' \
-  '*-atime:access time (days):' \
-  '*-ctime:inode change time (days):' \
-  '*-mtime:modification time (days):' \
-  '*-anewer:file to compare (access time):_files' \
-  '*-cnewer:file to compare (inode change time):_files' \
-  '*-newer:file to compare (modification time):_files' \
-  '*-used:access after inode change (days):' \
-  '*-empty' \
-  '*-executable' \
-  '*-false' \
   '*-fstype:file system type:_file_systems' \
-  '*-gid:numeric group ID:' \
   '*-group:group:_groups' \
-  '*-uid:numeric user ID:' \
-  '*-user:user:_users' \
-  '*-lname:link pattern to search:' \
-  '*-ilname:link pattern to search (case insensitive):' \
-  '*-name:name pattern to search:' \
-  '*-iname:name pattern to search (case insensitive):' \
-  '*-path:path pattern to search:' \
-  '*-ipath:path pattern to search (case insensitive):' \
-  '*-regex:regular expression to search:' \
-  '*-iregex:regular expression to search (case insensitive):' \
-  '*-wholename:full path pattern to search:' \
-  '*-iwholename:full path pattern to search (case insensitive):' \
   '*-inum:inode number:' \
   '*-links:number of links:' \
-  '*-nouser' \
+  '*-ls' \
+  '*-mount' \
+  '*-mtime:modification time (days)' \
+  '*-name:name pattern' \
+  '*-newer:file to compare (modification time):_files' \
   '*-nogroup' \
-  '*-perm:file permission bits:' \
-  '*-readable' \
-  '*-writable' \
-  '*-size:file size:' \
-  '*-samefile:same inode as:_files' \
-  '*-true' \
-  '*-type:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))' \
-  '*-xtype:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))' \
-  '*-delete' \
-  '*-exec:program: _command_names -e:*\;::program arguments: _normal' \
-  '*-execdir:program: _command_names -e:*\;::program arguments: _normal' \
+  '*-nouser' \
   '*-ok:program: _command_names -e:*\;::program arguments: _normal' \
-  '*-okdir:program: _command_names -e:*\;::program arguments: _normal' \
-  '*-fls:output file:_files' \
-  '*-fprint:output file:_files' \
-  '*-fprint0:output file:_files' \
-  '*-fprintf:output file:_files:output format:' \
+  '*-perm:file permission bits' \
   '*-print' \
-  '*-print0' \
-  '*-printf:output format:' \
   '*-prune' \
-  '*-quit' \
-  '*-ls' \
-  '*-and' '*-a' \
-  '*-or' '*-o' \
-  '*-not' \
+  '*-size:file size (blocks)' \
+  '*-type:file type:((b\:block\ special\ file c\:character\ special\ file d\:directory p\:named\ pipe f\:normal\ file l\:symbolic\ link s\:socket))' \
+  '*-user:user:_users' \
+  '*-xdev' \
+  '*-a' '*-o' \
   '*:directory:_files -/'
diff --git a/Completion/Unix/Command/_fuser b/Completion/Unix/Command/_fuser
index ba0f301ea..f497729fc 100644
--- a/Completion/Unix/Command/_fuser
+++ b/Completion/Unix/Command/_fuser
@@ -1,10 +1,18 @@
 #compdef fuser
 
-local -a args arg1
+local -a args argf variant
 typeset -A opt_args
 
-if _pick_variant -c $words[1] psmisc='(#i)psmisc' unix -V; then
+args=(
+  '-u[append the user name of the process owner to each PID]'
+  '(-f)-c[list all processes accessing files on the filesystem specified by name]'
+  '(-c)-f[list all processes accessing named files]'
+)
+argf=( '*:file:_files' )
 
+_pick_variant -r variant psmisc='(#i)psmisc' $OSTYPE -V
+case $variant in
+  psmisc)
   (( $+functions[_fuser_services] )) ||
   _fuser_services() {
     local expl suf ret=1
@@ -23,45 +31,51 @@ if _pick_variant -c $words[1] psmisc='(#i)psmisc' unix -V; then
       compset -S ',*' || suf=( -S ${${opt_args[-n]/?*/,}:-/} -r "/, \t\n\-" )
       _ports $suf && ret=0
     fi
-      
+
     return ret
   }
 
-  _arguments \
-    '(-s)-a[show all files specified on the command line]' \
-    {-c,-m}'[list all processes accessing files on the filesystem specified by name]' \
-    '-k[kill processes accessing the file]' \
-    '-i[ask for confirmation before killing]' \
-    '-l[list all known signal names]' \
-    '-n[select name space]:namespace:(file udp tcp)' \
-    '(-a)-s[silent operation]' \
-    '-signal[send alternate signal with -k]:signal:_signals' \
-    '-u[append the user name of the process owner to each PID]' \
-    '-v[verbose mode]' \
-    '-V[display version information]' \
-    '-4[search only for IPv4 sockets]' \
-    '-6[search only for IPv6 sockets]' \
-    '*:name: _alternative "files:file:_files" "services:service:_fuser_services"'
-
-else
-  case $OSTYPE in
-    solaris2.9 )
-      args=(
-	'-n[list only processes with non-blocking mandatory locks]' 
-	'-s[send alternate signal with -k]:signal:_signals' 
-      )
-    ;;
-    sysv4 )
-      (( $+words[(r)-k] )) && arg1=( ':name: _alternative signals\:signal\:_signals\ -p files:file:_files' )
-    ;;
-  esac
+    args+=(
+      '(-s)-a[show all files specified on the command line]' \
+      {-c,-m}'[list all processes accessing files on the filesystem specified by name]' \
+      '-k[kill processes accessing the file]' \
+      '-i[ask for confirmation before killing]' \
+      '(-)-l[list all known signal names]' \
+      '-n[select name space]:namespace:(file udp tcp)' \
+      '(-a -u -v)-s[silent operation]' \
+      '-v[verbose mode]' \
+      '-V[display version information]' \
+      '-4[search only for IPv4 sockets]' \
+      '-6[search only for IPv6 sockets]' \
+    )
+    argf=( '*:name: _alternative "files:file:_files" "services:service:_fuser_services"' )
+    [[ -prefix -  && -z ${${words[1,CURRENT-1]}[(r)-[A-Z][A-Z]*]} ]] &&
+        argf[1]+=' "signal:signals:_signals -P-"'
+  ;;
+  freebsd*|openbsd*|solaris2.<9->)
+    args+=(
+      '-s[send alternate signal]:signal:_signals'
+      '-k[send SIGKILL to each process]'
+    )
+  ;|
+  openbsd*|freebsd*)
+    args+=(
+      '-M[extra values from specified core file]:core file:_files'
+      '-N[extract name list from specified system]:system'
+    )
+  ;|
+  freebsd*) args+=( '-m[include mapped files]' ) ;;
+  solaris2.<9->)
+    args+=(
+      '-n[list only processes with non-blocking mandatory locks]'
+    )
+  ;;
+  solaris2.<10->)
+    args+=( '-d[report device usage for all minor nodes bound to same device]' )
+  ;;
+  sysv4 )
+    (( $+words[(r)-k] )) && argf=( ':name: _alternative signals\:signal\:_signals\ -p files:file:_files' )
+  ;;
+esac
 
-  _arguments \
-    '(-f)-c[list all processes accessing files on the filesystem specified by name]' \
-    '(-c)-f[list all processes accessing named files]' \
-    '-k[kill processes accessing the file]' \
-    '-u[append the user name of the process owner to each PID]' \
-    $args \
-    $arg1 \
-    '*:file:_files'
-fi
+_arguments -s $args $argf
diff --git a/Completion/Unix/Command/_gcore b/Completion/Unix/Command/_gcore
new file mode 100644
index 000000000..4933ffee6
--- /dev/null
+++ b/Completion/Unix/Command/_gcore
@@ -0,0 +1,50 @@
+#compdef gcore
+
+case $OSTYPE in
+  solaris*)
+    local -a content
+
+    content=(
+      'anon[anonymous private mappings]'
+      'ctf[CTF type information]'
+      'data[writable private file mappings]'
+      'dism[DISM mappings]'
+      'heap[process heap]'
+      'ism[ISM mappings]'
+      'rodata[read-only private file mappings]'
+      'shanon[anonymous shared mappings]'
+      'shfile[file-backed shared mappings]'
+      'shm[System V shared memory]'
+      'stack[process stack]'
+      'symtab[symbol table sections for loaded files]'
+      'text[readable and executable private file mappings]'
+    )
+
+    _arguments -s \
+      '(-c -g)-p[use per-process core file repository]' \
+      '(-c -p)-g[use global core file repository]' \
+      '-F[force grabbing the target process]' \
+      '(-p -g)-c[set core file content]: :_values -s + "content" $content' \
+      '-o[set core file base name]:file base name:_files' \
+      '*:pid:_pids'
+  ;;
+  netbsd*)
+    _arguments \
+      '-c+[write core file to specified file]:file:_files' \
+      '*:pid:_pids'
+    ;;
+  freebsd*)
+    _arguments -s \
+      '-c+[write core file to specified file]:file:_files' \
+      '-f[dump all available segments]' \
+      '-s[stop process while gathering image]' \
+      '::executable:' \
+      ':pid:_pids'
+  ;;
+  *)
+    # GNU GDB gcore
+    _arguments \
+      '-o[set core file base name]:file base name:_files' \
+      ':pid:_pids'
+  ;;
+esac
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 5068f6e48..d987c2b1e 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -1,4 +1,4 @@
-#compdef grep egrep fgrep -value-,GREP_OPTIONS,-default-
+#compdef grep egrep fgrep bsdgrep zgrep, zegrep, zfgrep -value-,GREP_OPTIONS,-default-
 # Ulrik Haugen 2001
 
 local arguments matchers command
diff --git a/Completion/Unix/Command/_iconv b/Completion/Unix/Command/_iconv
index 4bf29d410..d040be756 100644
--- a/Completion/Unix/Command/_iconv
+++ b/Completion/Unix/Command/_iconv
@@ -1,8 +1,8 @@
 #compdef iconv
 
-local expl curcontext="$curcontext" state line ret=1
+local expl curcontext="$curcontext" state line variant ret=1
 
-if _pick_variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gentoo)' unix --version; then
+if _pick_variant -r variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gentoo)' unix --version; then
   local -a args
   local exargs="-l --list -? --help --usage --version -V"
 
@@ -13,22 +13,22 @@ if _pick_variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gentoo)' unix -
     "($exargs)-c[omit invalid characters from output]"
     "(-s --silent --verbose $exargs)"{-s,--silent}'[suppress warnings]'
     '(-)'{-\?,--help}'[display help information]'
-    '(-)--usage[display a short usage message]'
     '(-)'{-V,--version}'[print program version]'
     '1:input file:_files' 
   )
 
-  case $_cmd_variant[$service] in
+  case $variant in
     (libiconv)
       args=( ${(R)args:#(|\*)(|\(*\))-[V\?]*} )  # remove -V and -?
       args+=(
-       '--byte-subst=[format for unconvertible bytes]:format string:'
-       '--widechar-subst=[format for unconvertible wide chars]:format string:'
-       '--unicode-subst=[format for unconvertible Unicode chars]:format string:'
+        '--byte-subst=[format for unconvertible bytes]:format string'
+        '--widechar-subst=[format for unconvertible wide chars]:format string'
+        '--unicode-subst=[format for unconvertible Unicode chars]:format string'
       )
       ;;
     (glibc)
       args+=( 
+        '(-)--usage[display a short usage message]'
         "(-o --output $exargs)"{-o+,--output=}'[specify output file]:output file:_files'
         "(-s --silent $exargs)--verbose[print progress information]"
       )
@@ -44,7 +44,7 @@ if _pick_variant libiconv='GNU*libiconv' glibc='(GNU*libc|EGLIBC|Gentoo)' unix -
     else
       _wanted codesets expl 'code set' compadd "$@" \
         -M 'm:{a-zA-Z}={A-Za-z} r:|-=* r:|=*' \
-        ${$(_call_program codesets iconv --list)%//} && ret=0
+        ${$(_call_program codesets $words[1] --list)%//} && ret=0
     fi
   fi
 
@@ -55,12 +55,17 @@ else
   local -U codeset
 
   _arguments -C \
-    '-f[specify code set of input file]:code set:->codeset' \
-    '-t[specify code set for output]:code set:->codeset' \
+    '(-l)-f[specify code set of input file]:code set:->codeset' \
+    '(-l)-t[specify code set for output]:code set:->codeset' \
+    '(-l)-c[omit invalid characters from output]' \
+    '(-l)-s[suppress warnings]' \
+    '(- 1)-l[list all character code sets]' \
     '1:file:_files' && return 0
 
   if [[ $state = codeset ]]; then
-    if [[ -f /usr/lib/iconv/iconv_data ]]; then  # IRIX & Solaris
+    if [[ $OSTYPE = freebsd* ]]; then
+      codeset=( $(_call_program codesets $words[1] -l) )
+    elif [[ -f /usr/lib/iconv/iconv_data ]]; then  # IRIX & Solaris
       codeset=( ${${(f)"$(</usr/lib/iconv/iconv_data)"}%%[[:blank:]]*} )
       codeset+=( /usr/lib/iconv/*%*.so(Ne.'reply=( ${${REPLY:t}%%%*} ${${REPLY:r}#*%} )'.) )
     elif [[ -d $LOCPATH/iconv ]]; then  # OSF
@@ -70,7 +75,7 @@ else
       return 1
     fi
 
-    _wanted codesets expl 'code set' compadd "$@" -a codeset
+    _wanted codesets expl 'code set' compadd -a codeset
   fi
 
 fi
diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id
index 36cdf4c19..74fe6d9e1 100644
--- a/Completion/Unix/Command/_id
+++ b/Completion/Unix/Command/_id
@@ -1,13 +1,49 @@
-#compdef id
+#compdef id gid
 
-_arguments \
-  '-a[no-op]' \
-  '(-Z --context)'{-Z,--context}'[print only context]' \
-  '(-g --group)'{-g,--group}'[print only EGID]' \
-  '(-G --groups)'{-G,--groups}'[print all GIDs]' \
-  '(-n --name)'{-n,--name}'[print name instead of number]' \
-  '(-r --real)'{-r,--real}'[print real ID instead of effective]' \
-  '(-u --user)'{-u,--user}'[print only EUID]' \
-  '--help[display help]' \
-  '--version[display version]' \
-  ':user:_users'
+local args choices
+
+if _pick_variant gnu=GNU $OSTYPE --version; then
+  choices='--help --version -Z --context -g --group -G --groups -u --user'
+  _arguments \
+    "($choices)"{-Z,--context}'[print only security context]' \
+    "($choices)"{-g,--group}'[print only EGID]' \
+    "($choices -r --real)"{-G,--groups}'[print all GIDs]' \
+    '(-n --name --help --version)'{-n,--name}'[show name instead of number]' \
+    '(-r --real -g --groups --help --version)'{-r,--real}'[show real ID instead of effective]' \
+    "($choices)"{-u,--user}'[print only EUID]' \
+    '(-z --zero --help --version)'{-z,--zero}'[delimit entries with NUL characters]' \
+    '(- :)--help[display help information]' \
+    '(- :)--version[display version]' \
+    ':user:_users'
+else
+  choices="-A -a -c -G -g -M -p -P -u"
+  args=(
+    "($choices)-g[print only EGID]"
+    "($choices -r)-G[print all GIDs]"
+    "($choices)-u[print only EUID]"
+    '(-A -c -M -P)-n[show name instead of number]'
+    '(-A -c -M -P)-r[show real ID instead of effective]'
+  )
+  case $OSTYPE in
+    solaris*)
+      args+=(
+        '(-g -G -u -n -r)-a[show user name, user ID and all the groups]'
+	'(-g -G -u -n -r)-p[show project membership]'
+      )
+    ;;
+    darwin*|dragonfly*|freebsd*)
+      args+=( '(-)-P[print id in the form of a password file entry]' )
+    ;|
+    darwin*|freebsd*)
+      args+=(
+	'(-)-A[print process audit user ID]'
+	'(-)-M[print MAC label of the current process]'
+      )
+    ;|
+    freebsd*) args+=( '(-)-c[print current login class]' ) ;|
+    darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
+      args+=( '(-)-p[human readable output]' )
+    ;;
+  esac
+  _arguments -s $args ':user:_users'
+fi
diff --git a/Completion/Unix/Command/_join b/Completion/Unix/Command/_join
index 956d9d3b8..4915a0600 100644
--- a/Completion/Unix/Command/_join
+++ b/Completion/Unix/Command/_join
@@ -1,23 +1,29 @@
-#compdef join
+#compdef join gjoin
 
-# completions for GNU join version 5.97
-
-local arguments
-
-arguments=(
-    '-a+[print unpairable lines coming from file FILENUM, where FILENUM is 1 or 2, corresponding to FILE1 or FILE2]:file number:(1 2)'
-    '-e+[replace missing input fields with EMPTY]:replacement string:'
-    '(-i --ignore-case)'{-i,--ignore-case}'[ignore differences in case when comparing fields]'
-    "-j+[equivalent to '-1 FIELD -2 FIELD']:field number:"
-    '-o+[obey FORMAT while constructing output line]:format string:'
-    '-t+[use CHAR as input and output field separator]:separator:'
-    '-v+[like -a FILENUM, but suppress joined output lines]:file number:(1 2)'
-    '-1+[join on this FIELD of file 1]:field number:'
-    '-2+[join on this FIELD of file 2]:field number:'
-    --help'[display help and exit]'
-    --version'[output version information and exit]'
-    '1:file 1:_files'
-    '2:file 2:_files'
+local args variant
+args=(
+  '*-a+[print unpairable lines from specified file]:file number:(1 2)'
+  '-e+[replace missing input fields with specified string]:replacement string'
+  "(-1 -2)-j+[join on specified field for both files]:field number"
+  '-o+[use specified output format]:format string'
+  '-t+[use specified character as field separator]:separator'
+  '*-v+[like -a, but suppress joined output lines]:file number:(1 2)'
+  '(-j -1 -j1)'{-j1,-1+}'[join on specified field of first file]:field number'
+  '(-j -2 -j2)'{-j2,-2+}'[join on specified field of second file]:field number'
+  '1:file:_files' '2:file:_files'
+)
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+case $variant in
+  gnu)
+    args+=(
+      '(-i --ignore-case)'{-i,--ignore-case}'[ignore differences in case when comparing fields]'
+      '(-)--help[display help information]'
+      '(-)--version[output version information]'
+      '(--check-order --nocheck-order)'{--check-order,--nocheck-order}
+      '--header[treat first line in each file as field headers]'
+      '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]'
     )
+  ;;
+esac
 
-_arguments -s $arguments
+_arguments -s $args
diff --git a/Completion/Unix/Command/_last b/Completion/Unix/Command/_last
index 43a08a709..706d82f26 100644
--- a/Completion/Unix/Command/_last
+++ b/Completion/Unix/Command/_last
@@ -1,17 +1,53 @@
 #compdef last lastb
 
-_arguments -s \
-  '-a[display hostname in last column]' \
-  '-n[number]:number' \
-  '-[number]:number' \
-  '-f[filename]:filename:_files' \
-  '-R[suppress display of hostname field]' \
-  '-d[translate IP to hostname]' \
-  '-i[display IP]' \
-  '-o[read old-format wtmp]' \
-  '-x[display shutdown/runlevel entries]' \
-  '-h[hostname]:host:_hosts' \
-  '-s[report duration in seconds]' \
-  '-t[tty]:tty' \
-  '-w[widen duration field]' \
-  '*:user:_users'
+local pattern arg args ttys
+ttys=( /dev/tty*(N) /dev/pts/*(N) reboot )
+ttys=( ${ttys#/dev/} )
+
+for pattern arg in \
+  '(solaris*|linux-gnu)' '-a[display hostname in last column]' \
+  '((free|net|open)bsd*|darwin*|dragonfly*|linux-gnu)' '-h[limit sessions by hostname]:host:_hosts' \
+  '((free|open)bsd*|linux-gnu)' '-s[report duration in seconds]' \
+  '(freebsd*|openbsd*)' '-d[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \
+  '((net|free|open)bsd*|darwin*|dragonfly*)' '-t[limit sessions by tty]:tty:compadd -a ttys' \
+  'openbsd*' '-c[calculate total time]' \
+  '^darwin*' '-f[specify account file]:file:_files' \
+  '(solaris*|linux-gnu|freebsd*|openbsd*)' '-n[specify number of lines to show]:number' \
+  '((open|net)bsd*|dragonfly*)' '-T[show more detailed time information including year and seconds]' \
+  'netbsd*' '-x[assume file is in wtmpx(5) format]' \
+  'netbsd*' '-n[show IP of remote hosts]' \
+  'freebsd*' '-w[show seconds in durarion field]' \
+  'freebsd*' '-y[show year in session start time]'
+do
+  [[ $OSTYPE = $~pattern ]] && args+=( $arg )
+done
+
+case $OSTYPE in
+  netbsd*|dragonfly*)
+    args+=(
+      '-H[specify width for host field]:width'
+      '-N[specify width for login name field]:width'
+      '-L[specify width for tty field]:width'
+    )
+  ;;
+  linux-gnu)
+    args+=(
+      '-R[suppress display of hostname field]'
+      '-d[translate IP to hostname]'
+      '-F[show full login and logout times and dates]'
+      '-i[show IP of remote hosts]'
+      '-o[read old-format wtmp]'
+      '-t[limit sessions to those active at snapshot time]:time (YYYYMMDDhhmmss)'
+      '-w[show full user and domain names]'
+      '-x[display shutdown/runlevel entries]'
+    )
+  ;;
+esac
+
+if [[ $OSTYPE = (linux-gnu|solaris*) ]]; then
+  args+=( '*:arg: _alternative "users:user:_users" "ttys:tty:compadd -a ttys"' )
+else
+  args+=( '*:user:_users' )
+fi
+
+_arguments -s $args
diff --git a/Completion/Unix/Command/_ldd b/Completion/Unix/Command/_ldd
index 381d12745..19b8a9105 100644
--- a/Completion/Unix/Command/_ldd
+++ b/Completion/Unix/Command/_ldd
@@ -1,6 +1,6 @@
 #compdef ldd
 
-if _pick_variant gnu='(GNU|EGLIBC|Gentoo)' solaris --version; then
+if _pick_variant gnu='(GNU|EGLIBC|Gentoo)' unix --version; then
   args=(
     '(- *)--version[display version information]'
     '(- *)--help[display help information]'
@@ -10,20 +10,31 @@ if _pick_variant gnu='(GNU|EGLIBC|Gentoo)' solaris --version; then
     '(-u --unused)'{-u,--unused}'[display any unused objects]'
   )
 else
-  args=(
-    -s
-    '(-r)-d[check immediate references]'
-    '(-d)-r[check immediate and lazy references]'
-    '-u[display any unused objects]'
-    '-U[display any unreferenced, or unused dependencies]'
-    '-e[set specified environment variable]:environment variable:(LD_PRELOAD LD_LIBRARY_PATH LD_RUN_PATH LD_DEBUG LD_DEBUG_OUTPUT LD_NOCONFIG LD_NOAUXFLTR)'
-    '-f[check for insecure executable]'
-    '-i[display order of execution of initialization sections]'
-    '-L[enable lazy loading]'
-    '-l[force immediate processing of any filters]'
-    '-s[display search path used]'
-    '-v[displays all dependency relationships]'
-  )
+  case $OSTYPE in
+    solaris*)
+      args=(
+	-s
+	'(-r)-d[check immediate references]'
+	'(-d)-r[check immediate and lazy references]'
+	'-u[display any unused objects]'
+	'-U[display any unreferenced, or unused dependencies]'
+	'-e[set specified environment variable]:environment variable:(LD_PRELOAD LD_LIBRARY_PATH LD_RUN_PATH LD_DEBUG LD_DEBUG_OUTPUT LD_NOCONFIG LD_NOAUXFLTR)'
+	'-f[check for insecure executable]'
+	'-i[display order of execution of initialization sections]'
+	'-L[enable lazy loading]'
+	'-l[force immediate processing of any filters]'
+	'-s[display search path used]'
+	'-v[displays all dependency relationships]'
+      )
+    ;;
+    freebsd*)
+      args=(
+        '-a[show all objects that are needed by each loaded object]'
+	'-v[verbose listing of the dynamic linking headers]'
+	'-f+[specify format]:format:((%a\:program\ name %A\:environment\ name %o\:library\ name %p\:path\ to\ library %x\:load\ address))'
+      )
+    ;;
+  esac
 fi
 
 _arguments $args \
diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index 7680f9273..f2e149453 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -1,11 +1,8 @@
 #compdef ls gls
-# Ulrik Haugen 2001
 
 local arguments is_gnu
 
-_pick_variant -r is_gnu gnu=gnu unix --help
-
-if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; then
+if ! _pick_variant gnu=gnu unix --help; then
   arguments=(
     '(-A)-a[list entries starting with .]'
     '(-a)-A[list all except . and ..]'
@@ -14,10 +11,8 @@ if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; th
     '-R[list subdirectories recursively]'
 
     '(-k)-h[print sizes in human readable form]'
-    '(-h)-k[print sizes of 1k]'
 
     '-i[print file inode numbers]'
-
     '(-l -g -1 -C -m -x)-l[long listing]'
     '(-l -1 -C -m -x)-g[long listing but without owner information]'
     '(-l -g -C -m -x)-1[single column output]'
@@ -25,35 +20,36 @@ if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; th
     '(-l -g -1 -C -x)-m[comma separated]'
     '(-l -g -1 -C -m)-x[sort horizontally]'
 
-    '-o[display file flags]'
-
     '-s[display size of each file in blocks]'
 
     '(-u)-c[status change time]'
     '(-c)-u[access time]'
 
-    '-f[unsorted, all, short list]'
     '-r[reverse sort order]'
 
-    '(-t)-S[sort by size]'
     '(-S)-t[sort by modification time]'
 
     '(-p)-F[append file type indicators]'
     '(-F)-p[append file type indicators for directory]'
 
-    '-f[output is not sorted]'
-
     '-n[numeric uid, gid]'
 
-    '-T[show complete time information]'
-
-    '(-B -b -w -q)-B[print octal escapes for control characters]'
     '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]'
     '(-B -b -w -q)-q[hide control chars]'
-    '(-B -b -w -q)-w[print raw characters]'
 
     '*:files:_files'
   )
+  if [[ "$OSTYPE" = (netbsd*|dragonfly*|freebsd*|openbsd*|darwin*) ]]; then
+    arguments+=(
+      '(-h)-k[print sizes of 1k]'
+      '(-t)-S[sort by size]'
+      '-T[show complete time information]'
+      '-o[display file flags]'
+      '-f[output is not sorted]'
+      '(-B -b -w -q)-w[print raw characters]'
+      '(-B -b -w -q)-B[print octal escapes for control characters]'
+    )
+  fi
   if [[ "$OSTYPE" = (freebsd*|darwin*) ]]; then
     arguments+=(
       '-G[enable colorized output]'
@@ -61,6 +57,18 @@ if [[ "$OSTYPE" = (netbsd*|freebsd*|openbsd*|darwin*) && "$is_gnu" != gnu ]]; th
       '-P[do not follow symlinks]'
     )
   fi
+  if [[ $OSTYPE = solaris* ]]; then
+    arguments+=(
+      '(-l -1 -C -m -x)-o[long listing but without group information]'
+      '(-l -t -s -r -a)-f[interpret each argument as a directory]'
+      '(-E -l)-e[long listing with full and consistent date/time]'
+      '(-e -l)-E[long listing with ISO format date/time]'
+      '-H[follow symlinks on the command line]'
+      '-v[long listing with verbose ACL information]'
+      '-V[long listing with compact ACL information]'
+      '-@[long listing with marker for extended attribute information]'
+    )
+  fi
 else
   arguments=(
     '(--all -a -A --almost-all)'{--all,-a}'[list entries starting with .]'
@@ -131,10 +139,6 @@ else
     '(- :)--version[display version information]'
     '*:files:_files'
   )
-  # remove long options?
-  if [[ $is_gnu != gnu ]]; then
-    arguments=( ${${${arguments:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
-  fi
 fi
 
 _arguments -s $arguments
diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum
index 2351d1abd..c881a4e6d 100644
--- a/Completion/Unix/Command/_md5sum
+++ b/Completion/Unix/Command/_md5sum
@@ -1,10 +1,13 @@
-#compdef md5sum
+#compdef md5sum gmd5sum
 
 _arguments -S \
   '(-b --binary)'{-b,--binary}'[read in binary mode]' \
   '(-c --check)'{-c,--check}'[read MD5 sums from the FILEs and check them]' \
+  '--tag[create a BSD-style checksum]' \
   '(-t --text)'{-t,--text}'[read in text mode]' \
+  '(-q --quiet)'{-q,--quiet}"[don't print OK for each successfully verified file]" \
   '--status[no output, status code shows success]' \
+  '--strict[exit non-zero for improperly formatted checksum lines]' \
   '(-w --warn)'{-w,--warn}'[warn about improperly formatted checksum lines]' \
   '--help[display help and exit]' \
   '--version[output version information and exit]' \
diff --git a/Completion/Unix/Command/_mkdir b/Completion/Unix/Command/_mkdir
index 58d6c743b..f2299f7c7 100644
--- a/Completion/Unix/Command/_mkdir
+++ b/Completion/Unix/Command/_mkdir
@@ -1,33 +1,23 @@
-#compdef mkdir
+#compdef mkdir gmkdir zf_mkdir
 
-local curcontext="$curcontext" line state \
-  args args_zsh args_cmd variant expl ret=1
-typeset -a opt_args
+local curcontext="$curcontext" state line expl args variant ret=1
+typeset -A opt_args
 
 args=(
   '(-m --mode)'{-m,--mode=}'[set permission mode]:numeric mode'
   '(-p --parents)'{-p,--parents}'[make parent directories as needed]'
-  )
-
-args_zsh=('(-)*: :->directories')
-
-args_cmd=(
-  '(-v --verbose)'{-v,--verbose}'[print message for each created directory]'
-  '(- :)--help[display help information]'
-  '(- :)--version[display version information]'
-  '*: :->directories'
-  )
+  '(-)*: :->directories'
+)
 
 case "$OSTYPE" in
   linux*)
-    args_cmd=(
+    args+=(
       '(-Z --context)'{-Z,--context=}'[set SELinux context]:SELinux context'
-      $args_cmd)
-    ;;
+    )
+  ;;
 esac
 
-_pick_variant -r variant gnu=gnu zsh='\(eval\)' unix --help
-
+_pick_variant -r variant gnu=gnu zsh='\(eval\)' $OSTYPE --help
 # It can still happen that there is a precommand command or builtin in the line.
 # In such cases, the variant has to be modified suitably, after further checking
 # the variant of the _command_ mkdir.
@@ -44,26 +34,34 @@ _pick_variant -r variant gnu=gnu zsh='\(eval\)' unix --help
 #   variant=zsh
 # fi
 
-if [[ $variant == zsh ]]; then
-  args+=($args_zsh)
-else
-  args+=($args_cmd)
-fi
-
-# remove long options?
-[[ $variant != gnu ]] && args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
+case $variant in
+  gnu|freebsd*|dragonfly*)
+    args+=(
+      '(-v --verbose)'{-v,--verbose}'[print message for each created directory]'
+    )
+  ;|
+  gnu)
+    args+=(
+      '(- :)--help[display help information]'
+      '(- :)--version[display version information]'
+    )
+  ;;
+  zsh) # remove all options
+    args=( '*: :->directories' )
+  ;;
+  *) # non-GNU: remove long options
+    args=( ${${${args:#(|*\))--*}//--[^ )]#/}/\( #\)/} )
+  ;;
+esac
 
 _arguments -C -s $args && ret=0
 
 case "$state" in
   directories)
-    if (( $ret )) && [[ ! -prefix - ]] || \
-      [[ $variant == zsh && ${#${${words[2,-1]}:#-*}} -gt 0 ]]; then
-      _wanted directories expl \
-        'parent directory (alternatively specify name of directory)' \
-        _path_files -/ && ret=0
-    fi
-    ;;
+    _wanted directories expl \
+      'parent directory (alternatively specify name of directory)' \
+      _path_files -/ && ret=0
+  ;;
 esac
 
 return ret
diff --git a/Completion/Unix/Command/_nl b/Completion/Unix/Command/_nl
new file mode 100644
index 000000000..b3876dc65
--- /dev/null
+++ b/Completion/Unix/Command/_nl
@@ -0,0 +1,40 @@
+#compdef nl gnl
+
+local curcontext="$curcontext" state line args ret=1
+
+args=(
+  '(-b --body-numbering)'{-b+,--body-numbering=}'[specify style for body lines]:style:->styles'
+  '(-d --section-delimiter)'{-d+,--section-delimiter=}'[separate logical pages with specified delimiter]:delimiter'
+  '(-f --footer-numbering)'{-f+,--footer-numbering=}'[specify style for footer lines]:style:->styles'
+  '(-h --header-numbering)'{-h+,--header-numbering=}'[specify style for header lines]:style:->styles'
+  '(-i --line-increment)'{-i+,--line-increment=}'[line number increment at each line]:increment'
+  '(-l --join-blank-lines)'{-l+,--join-blank-lines=}'[count consecutive empty lines as one]:number'
+  '(-n --number-format)'{-n+,--number-format=}'[specify format for line numbers]:format:((ln\:left\ justified rn\:right\ justified rz\:right\ justified\ with\ leading\ zeroes))'
+  '(-p --no-renumber)'{-p,--no-renumber}"[don't reset line numbers at logical pages]"
+  '(-s --number-separator)'{-s+,--number-separator=}'[add specified string after line numbers]:string'
+  '(-v --starting-line-number)'{-v+,--starting-line-number=}'[specify first line number on each logical page]:initial number'
+  '(-w --number-width)'{-w+,--number-width=}'[specify number of columns for line numbers]:columns'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  args+=(
+    '(- *)--help[display help information]'
+    '(- *)--version[display version information]'
+  )
+else
+  args=( ${(R)args:#(|\*)(|\(*\))--*} )    # remove long options
+fi
+
+_arguments -C -s $args '*:file:_files' && ret=0
+
+if [[ -n $state ]]; then
+  if compset -P p; then
+    _message -e regex 'regular expression'
+  else
+    _describe -t styles style '( p:number\ only\ lines\ matching\ regex )' -S '' -- '(
+      a:number\ all\ lines
+      t:number\ only\ non-empty\ lines
+      n:no\ line\ numbering
+    )'
+  fi
+fi || return ret
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 7f395d614..80136329d 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -1,6 +1,6 @@
-#compdef nm
+#compdef nm eu-nm
 
-local args files
+local args files variant
 
 _nm_object_file() {
   [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]]
@@ -15,7 +15,7 @@ args=(
   '(-t --radix -o -x)'{-t,--radix}'[specify radix for numeric values]:radix:((d\:decimal o\:octal x\:hexadecimal))'
 )
 
-if _pick_variant gnu=GNU unix -V; then
+if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfutils unix -V; then
   compset -P '@' && files='*:options file:_files'
   args+=(
     '(- *)--help[display help information]'
@@ -24,22 +24,47 @@ if _pick_variant gnu=GNU unix -V; then
     '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)'
     "(-C --demangle)--no-demangle[don't decode symbol names]"
     '(-u --undefined-only)--defined-only[display only defined symbols]'
-    '(-f --format -P)'{-f+,--format=}'[specify output format]:format:(bsd sysv posix)'
-    '(-l --line-numbers)'{-l,--line-numbers}'[display source file and line numbers from debug information]'
-    '(-n --numeric-sort -p --no-sort --size-sort)'{-n,--numeric-sort}'[sort symbols numerically by address]'
+    '(-f --format -P)--format=[specify output format]:format:(bsd sysv posix)'
+    '(-n --numeric-sort -p --no-sort --size-sort -v)'{-n,--numeric-sort}'[sort symbols numerically by address]'
     '(-p --no-sort -n --numeric-sort -r -P --reverse-sort --size-sort)'{-p,--no-sort}'[do not sort symbols]'
     '(-P --portability -B -f --format)'{-P,--portability}'[same as --format=posix]'
-    '(-r --reverse-sort -p --no-sort --size-sort)'{-r,--reverse-sort}'[reverse sort order]'
-    '--plugin[load specified plugin]:plugin'
+    '(-r --reverse-sort -p --no-sort --size-sort -v)'{-r,--reverse-sort}'[reverse sort order]'
     '(-u --undefined-only --defined-only)'{-u,--undefined-only}'[display only undefined symbols]'
-    "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
     '(-a --debug-syms)'{-a,--debug-syms}'[display debugger-only symbols]'
     '(-S --print-size)'{-S,--print-size}'[print size of defined symbols]'
     '(-s --print-armap)'{-s,--print-armap}'[include index for symbols from archive members]'
-    '(-p --no-sort -n --numeric-sort -r)--size-sort[sort symbols by size]'
-    '--special-syms[include special symbols in the output]'
-    '--synthetic[display synthetic symbols as well]'
+    '(-p --no-sort -n --numeric-sort -r -v)--size-sort[sort symbols by size]'
   )
+  case $variant in
+    elftoolchain|binutils)
+      args+=(
+	'(-l --line-numbers)'{-l,--line-numbers}'[display source file and line numbers from debug information]'
+      )
+    ;|
+    elftoolchain)
+      args=( ${args:#*--(portability|extern-only)\[*}
+        '(- *)-h[display help information]'
+	'(-t -x)-o[print values in octal]'
+	'(-t -o)-x[print values in hexadecimal]'
+	'(--size-sort)-v[sort output by value]'
+      )
+    ;;
+    elfutils)
+      args+=(
+        '--mark-special[mark special symbols]'
+	'--color=[use color in output]:color:(always auto never)'
+      )
+    ;;
+    binutils)
+      args+=(
+	'(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)'
+	'--plugin[load specified plugin]:plugin'
+	'--special-syms[include special symbols in the output]'
+	'--synthetic[display synthetic symbols as well]'
+	"--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
+      )
+    ;;
+  esac
 else
   # following flags are accurate for Solaris
   args=( ${args:#(|*\)(\*|))-[o-]*}
diff --git a/Completion/Unix/Command/_od b/Completion/Unix/Command/_od
index 59775abf6..db75b3f96 100644
--- a/Completion/Unix/Command/_od
+++ b/Completion/Unix/Command/_od
@@ -1,4 +1,4 @@
-#compdef od
+#compdef od god
 
 local curcontext="$curcontext" state state_descr line args ret=1
 local -A opt_args
@@ -25,6 +25,8 @@ if _pick_variant gnu=GNU unix --version; then
   # -h -B -I and -L are obsolescent and undocumented
   args=( ${(R)args:#(|\*)(|\(*\))-[hBIL]*} )
   args+=(
+    '--traditional'
+    '--endian=[swap input bytes]:endianess:(big little)'
     {-S+,--strings=-}'[output strings of at least specfied bytes long]:length'
     {-w-,--width=-}'[output specified bytes per line]:bytes'
     '(- : *)--help[display help and exit]'
@@ -33,18 +35,29 @@ if _pick_variant gnu=GNU unix --version; then
 else
   args=( ${(R)args:#(|\*)(|\(*\))--*} )    # remove long options
   case "$OSTYPE" in
-    (darwin*|freebsd*|dragonfly*|openbsd*)
+    darwin*|freebsd*|dragonfly*|openbsd*)
       args+=(
-        '-D[output unsigned decimal ints (-t u4)]'
+        '-D[output unsigned decimal integers (-t u4)]'
         {-e,-F}'[output double-precision floats (-t fD)]'
         {-H,-X}'[output hexadecimal ints (-t x4)]'
         '-O[output octal ints (-t o4)]'
       )
-      ;;
+    ;;
+    solaris*)
+      args=(
+        ${(M)args:#(|\*)(|\(*\))-[AjNtvbcdfosx]*}
+	'-C[output all printable characters and use C-style escapes]'
+	'-D[output unsigned decimal long words (-t u4)]'
+	'-F[output double-precision floats (-t f8)]'
+	'-O[output octal ints (-t o4)]'
+	'-S[output decimal ints (-t d4)]'
+	'-X[output hexadecimal ints (-t x4)]'
+      )
+    ;;
     (*)
       # POSIX options only
       args=( ${(M)args:#(|\*)(|\(*\))-[AjNtvbcdosx]*} )
-      ;;
+    ;;
   esac
 fi
 
diff --git a/Completion/Unix/Command/_patch b/Completion/Unix/Command/_patch
index add436702..c0df00c00 100644
--- a/Completion/Unix/Command/_patch
+++ b/Completion/Unix/Command/_patch
@@ -1,7 +1,7 @@
-#compdef patch
+#compdef patch gpatch
 
 if (( ! $+_patch_args )); then
-  local help="$(LC_ALL=C patch --help 2>&1)"
+  local help="$(LC_ALL=C $words[1] --help 2>&1)"
   local -A optionmap
   local arg
   local comp_p='compadd "$expl[@]" -S0 -r "1-9" - ""'
diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping
index e59f6fa9f..a1a50e11f 100644
--- a/Completion/Unix/Command/_ping
+++ b/Completion/Unix/Command/_ping
@@ -33,31 +33,37 @@ if _pick_variant iputils=iputils unix -V; then
 
 else
 
-# FreeBSD 4.11
-
   _arguments \
     '-A[audible for no packet]' \
-    '-Q[somewhat quiet]' \
-    '-R[record route]' \
     '-a[audible for each packet]' \
+    '-c:count' \
+    "-D[set the don't fragment bit]" \
     '-d[set SO_DEBUG on the socket]' \
     '-f[flood ping]' \
-    '-n[numeric output only]' \
-    '-q[quiet]' \
-    '-r[bypass normal routing tables]' \
-    '-v[verbose]' \
-    '-c:count' \
+    '-G[specify maximum size for ICMP payload for sweeping pings]:size' \
+    '-g[specify minimum size for ICMP payload for sweeping pings]:size [0]' \
+    '-h[specify size increment for ICMP payload for sweeping pings]:size [1]' \
     '-i:wait seconds' \
+    '-I[source interface for multicast packets]:iface:_net_interfaces' \
+    '-L[suppress loopback of multicast packets]' \
     '-l:preload number' \
+    '-M:icmp:(mask time)' \
     '-m:ttl' \
-    '-p:padding pattern' \
+    '-n[numeric output only]' \
+    '-o[exit after receiving one packet]' \
     '-P:IPsec policy' \
+    '-p:padding pattern' \
+    '-Q[somewhat quiet]' \
+    '-q[quiet]' \
+    '-R[record route]' \
+    '-r[bypass normal routing tables]' \
+    '-S:source address' \
     '-s:packet size in bytes' \
-    '-S:src addr' \
-    '-t:timeout in seconds' \
-    '-L[suppress loopback of multicast packets]' \
-    '-I:iface:_net_interfaces' \
     '-T:ttl for multicasted packets' \
+    '-t:timeout in seconds' \
+    '-v[verbose]' \
+    '-W:wait time (ms)' \
+    '-z:type of service' \
     ':host:_hosts'
 
 fi
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
new file mode 100644
index 000000000..925f48390
--- /dev/null
+++ b/Completion/Unix/Command/_ps
@@ -0,0 +1,188 @@
+#compdef ps
+
+_ps_props() {
+  local opts
+
+  if [[ $1 = -s ]]; then
+    shift
+    compset -P '[+-]' || _describe -t modifiers modifier \
+	'( +:ascending\ order -:descending\ order )' -S ''
+  fi
+
+  case $OSTYPE in
+    linux-gnu) opts=( ${${(f)"$(_call_program properties $words[1] L)"}%% *} ) ;;
+    freebsd*) opts=( $(_call_program properties $words[1] L) ) ;;
+    solaris*) opts=( ${=${(f)"$(_call_program properties $words[1] - 2>&1)"}[-3,-1]} ) ;;
+  esac
+
+  compadd "$@" -a opts
+}
+
+local curcontext="$curcontext" state line expl ret=1
+local short long
+local -a args bsd bsdarg pids
+local -A equivs
+
+args=(
+  '-a[select processes with tty except session leaders]'
+  {-A,-e}'[select every process]'
+  '-d[select all processes except session leaders]'
+  '*-p+[select processes by ID]:process ID:_sequence -s , _pids'
+  '*-G+[select processes by real group]:group:_sequence -s , _groups'
+  '*-g+[select processes by effective group or session]:group:_sequence -s , _groups'
+  '*-s+[select processes by session leaders]:session leader:_sequence -s , _pids'
+  '*-t+[select processes by attached terminal]:tty:_sequence -s , compadd - /dev/pts/<->(N\:s/\\/dev\\//) /dev/tty*(N\:t)'
+  '*-u+[select processes by effective user]:user:_sequence -s , _users'
+  '*-U+[select processes by real user]:user:_sequence -s , _users'
+  '-o+[specify output format]:property:_sequence -s , _ps_props -'
+
+  '-c[show scheduler properties]'
+  '-f[full listing]'
+  '-j[show session ID and process group ID]'
+  '-l[long listing]'
+  '-L[show information about each light weight process]'
+  '-y[show RSS in place of ADDR (used with -l)]'
+)
+
+bsd=(
+  'a[include processes belonging to other users]'
+  'e[show environment after command]'
+  '(j s u v X)l[output in long format]'
+  '(l s u v X)j[output in job control format]'
+  'x[include processes with no controlling terminal]'
+  '(j l s v X)u[output in resource usage format]'
+  '(j l s u X)v[output in virtual memory format]'
+  '*w[wide output]'
+  'H[show threads as if they were processes]'
+  'L[display all format specifiers]'
+  'S[include child process data with the parent]'
+  'T[select processes attached to current terminal]'
+  'Z[show security data]'
+)
+bsdarg=(
+  '*p[select processes by ID]'
+  '*t[select processes by attached terminal]'
+  '*U[select processes by effective user]'
+  'O[specify additional output fields]'
+  'o[specify output format]'
+  'N[set namelist file for WCHAN display]'
+)
+
+case $OSTYPE in
+  solaris2.<11->)
+    args+=(
+      '-h[select processes homed to the specified lgrp]:lgrp list'
+      '-H[show home lgroup of the process]'
+    )
+  ;|
+  solaris*)
+    args+=(
+      '-P[show processor to which the process or lwp is bound]'
+      '*-z[select processes by zone]:zone list:_sequence _zones'
+      '-Z[show zone with which process is associated]'
+    )
+  ;;
+  darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
+    bsd+=(
+      'A[select every process]'
+      'C[ignore resident time for CPU percentage]'
+      'c[show just executable name for command]'
+      'h[repeat header lines, one per page of output]'
+      '(r)m[sort by memory usage]'
+      '(m)r[sort by CPU usage]'
+    )
+    bsdarg+=(
+      'M[extract values from specified core]'
+    )
+  ;|
+  linux-gnu|netbsd*) bsdarg+=( 'k[specify sort order]' ) ;|
+  darwin*|freebsd*) bsdarg+=( 'G[select processes by real group]' ) ;|
+  freebsd*)
+    bsd+=(
+      'd[show process hierarchy]'
+      'f[show command and environment for swapped out processes]'
+      '*J[select processes by jail ID]'
+    )
+  ;;
+  netbsd*) bsd+=( '(j l u v)s[output in thread format]' ) ;;
+  openbsd*)
+    bsd+=(
+      'k[display information about kernel threads]'
+    )
+    bsdarg+=( 'W[extract swap information from the specified file]' )
+  ;;
+  linux-gnu)
+    args+=(
+      '-O+[specify additional output fields]:property:_sequence -s , _ps_props -'
+      '(-N --deselect)'{-N,--deselect}'[negate selection: all processes except those selected]'
+      '*-C[select processes by command name]:command:_sequence -s , _command_names -e'
+      '*--ppid[select processes by parent process ID]:parent process:_sequence -S , _pids'
+      '(-f)-F[extra full format listing]'
+      '--context[show SELinux security context format]'
+      '-M[show security data]'
+      '(--forest -H)'{--forest,-H}'[show process hierarchy]'
+      '--headers[repeat header lines, one per page of output]'
+      '(--cols --columns --width)'{--cols,--columns,--width}'[set screen width]:width'
+      '(--lines --rows)'{--lines,--rows}'[set screen height]'
+      '--cumulative[include child process data with the parent]'
+      '-n[set namelist file for WCHAN display]:file:_files'
+      '(--no-headers --no-heading)'{--no-headers,--no-heading}'[suppress headers]'
+      '--sort=[specify sort order]:order:_ps_props -s'
+      '-w[wide output]'
+      '-m[show threads after processes]'
+      '-T[show threads, with SPID column]'
+      '-Z[show security context format (SELinux)]'
+      '(- *)--help[display help information]::subject:(simple list output threads misc all)'
+      '(- *)--info[display debugging information]'
+      '(- *)'{-V,--version}'[display version information]'
+    )
+    equivs=( G Group g group p pid s sid t tty U User u user o format )
+    for short long in ${(kv)equivs}; do
+      args+=( ${${(M)args:#(\*|)-$short*}/$short+/-$long=} )
+    done
+    bsd+=(
+      'c[show true command name]'
+      'f[show process hierarchy]'
+      'h[suppress header]'
+      'm[show threads after processes]'
+      'n[numeric output for WCHAN and USER]'
+      'r[select running processes]'
+      '(j l u v X)s[output in signal format]'
+      'V[display version information]'
+      '(j l s u v)X[output in register format]'
+    )
+  ;;
+esac
+
+if (( CURRENT > 1 )) && [[ $OSTYPE != solaris* || ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then
+  case $words[CURRENT-1] in
+    *k)
+      _wanted -C option-k-1 properties expl 'property' _sequence -s , _ps_props -s - && return
+    ;;
+    *G) _sequence -s , _groups && return ;;
+    *J) _sequence -s , _jails && return ;;
+    *[MNW]) _files && return ;;
+    *t)
+      _wanted -C option-t-1 ttys expl tty _sequence -s , \
+	  compadd - /dev/pts/<->(N\:s/\\/dev\\//) /dev/tty*(N\:t) && return
+    ;;
+    *p) _wanted -C option-p-1 processes expl 'process ID' _sequence -s , _pids && return;;
+    *U) _wanted -C option-U-1 users expl user _sequence -s , _users && return ;;
+    *[oO]) _wanted -C "option-${words[CURRENT-1][-1]}-1" properties \
+        expl 'property' _sequence -s , _ps_props - && return ;;
+  esac
+fi
+
+if [[ $OSTYPE = (*bsd*|darwin*|dragonfly*) ]]; then
+  compset -P - && pids=1
+else
+  _arguments -C -s $args '*:: :->rest' && ret=0
+  [[ -z "$state" || $OSTYPE = solaris* ]] && return ret
+fi
+
+_values -s '' -S ' ' 'options' $bsd && ret=0
+_values -S ' ' 'options' $bsdarg && ret=0
+if [[ -z $pids ]]; then
+  _pids && compstate[insert]=
+fi
+return ret
diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf
new file mode 100644
index 000000000..9312ea864
--- /dev/null
+++ b/Completion/Unix/Command/_readelf
@@ -0,0 +1,62 @@
+#compdef readelf eu-readelf
+
+local variant args sections
+
+_elf_file() {
+  [[ -x $REPLY || $REPLY = (core*|*.([ao]|so|elf)) ]]
+}
+
+sections=( .bss .data .dynamic .dynsym .got .interp .shstrtab .symtab .text )
+_pick_variant -r variant elftoolchain=elftoolchain elfutils=elfutils binutils --version
+
+args=(
+  '(-a --all)'{-a,--all}'[show all tables]'
+  '(-h --file-header)'{-h,--file-header}'[show file header]'
+  '(-l --program-headers --segments)'{-l,--program-headers,--segments}'[show program headers]'
+  '(-S --section-headers --sections)'{-S,--section-headers,--sections}'[show sections header]'
+  '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]'
+  '(-n --notes)'{-n,--notes}'[show core notes (if present)]'
+  '(-r --relocs)'{-r,--relocs}'[show relocations (if present)]'
+  '(-d --dynamic)'{-d,--dynamic}'[show dynamic section (if present)]'
+  '(-V --version-info)'{-V,--version-info}'[show version sections (if present)]'
+  '(-A --arch-specific)'{-A,--arch-specific}'[show architecture specific information (if any)]'
+  '(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]'
+  \*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)"
+  \*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)"
+  '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t)'
+  '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges)'
+  '(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]'
+  '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]'
+  '(- *)'{-H,--help}'[display help information]'
+  '(- *)'{-v,--version}'[display version information]'
+  "*:elf file:_files -g '*(-.e:_elf_file:)'"
+)
+
+case $variant in
+  elftoolchain|binutils)
+    args+=(
+      '(-g --section-groups)'{-g,--section-groups}'[show section groups]'
+      '(-t --section-details)'{-t,--section-details}'[show section details]'
+      '(-e --headers)'{-e,--headers}'[show file, program and sections headers]'
+      '(-u --unwind)'{-u,--unwind}'[show unwind info (if present)]'
+      '(-D --use-dynamic)'{-D,--use-dynamic}'[use dynamic section info when showing symbols]'
+    )
+  ;|
+  binutils)
+    args+=(
+      '--dyn-syms[show dynamic symbol table]'
+      \*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)"
+      "--dwarf-depth=[don't show DIEs at greater than specified depth]:depth"
+      '--dwarf-start=[show DIEs starting at specified depth or deeper]:depth'
+    )
+  ;;
+  elfutils)
+    args+=(
+      '--elf-section[used specified section as ELF input data]::section'
+      '(-e --exception)'{-e,--exception}'[show sections for exception handling]'
+      '(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]"
+    )
+  ;;
+esac
+
+_arguments -s "$args[@]"
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 1f156c481..4728ad464 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -1,4 +1,4 @@
-#compdef rm
+#compdef rm grm zf_rm
 
 declare -a opts args
 args=(
@@ -16,12 +16,25 @@ if _pick_variant gnu=gnu unix --help; then
     '--one-file-system[stay within filesystems of files given as arguments]'
     '(                   --preserve-root)--no-preserve-root[do not treat / specially]'
     '(--no-preserve-root                )--preserve-root[do not remove / (default)]'
+    '(-d --dir)'{-d,--dir}'[remove directories as well]'
     '(-v --verbose)'{-v,--verbose}'[explain what is being done]'
     '(- *)--help[display help message and exit]'
     '(- *)--version[output version information and exit]'
   )
 else
   args=(${args:#*--(force|recursive)\[*})
+  case $OSTYPE in
+    freebsd*)
+      args+=(
+        '-d[remove directories as well]'
+	'(-i)-I[prompt when removing many files]'
+	'-P[overwrite files before deleting them]'
+	'-v[explain what is being done]'
+	'-W[attempt to undelete named files]'
+	"-x[don't cross file systems when removing a hierarchy]"
+      )
+    ;;
+  esac
 fi
 
 local curcontext=$curcontext state line ret=1
diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed
index 476575205..8e2385cc8 100644
--- a/Completion/Unix/Command/_sed
+++ b/Completion/Unix/Command/_sed
@@ -1,22 +1,29 @@
-#compdef sed
+#compdef sed gsed psed s2p
 
-local args
+local args inplace extended
 
 args=(
   '(-n --quiet --silent)'{-n,--quiet,--silent}'[suppress automatic printing of pattern space]'
-  '(1)*'{-e,--expression=-}'[add sed commands to run]:sed script'
+  '(1)*'{-e,--expression=-}'[specify sed commands to run]:sed script'
   '(1)*'{-f,--file=-}'[add contents of file to commands to run]:file:_files'
   '(-e)1: :_guard "^-*" sed script'
   '*:input file:_files'
 )
+inplace='[edit files in-place, running scripts separately for each file]::suffix for backup'
+extended='[use extended regular expressions]'
 
-if _pick_variant gnu=GNU unix --version; then
+if [[ $service = (psed|s2p) ]]; then
+  args=(
+    "${(@)args:#(|\(*\))(|\*)--*}"
+    '-a[delay opening files listed with w function]'
+  )
+elif _pick_variant gnu=GNU unix --version; then
   args+=(
     '--follow-symlinks[follow symlinks when processing in place]'
-    '(-i --in-place)'{-i-,--in-place=-}'[edit files in place]::suffix for backup'
+    '(-i --in-place)'{-i-,--in-place=-}$inplace
     '(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]'
     '(-r)--posix[disable GNU extensions]'
-    '(-r --regexp-extended)'{-r,--regexp-extended}'[use extended regular expressions]'
+    '(-r --regexp-extended)'{-r,--regexp-extended}$extended
     '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]'
     '(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]'
     '(- 1 :)--help[print program usage]'
@@ -24,6 +31,27 @@ if _pick_variant gnu=GNU unix --version; then
   )
 else
   args=( "${(@)args:#(|\(*\))(|\*)--*}" )
+  case $OSTYPE in
+    openbsd*|freebsd*|netbsd*|darwin*|dragonfly*)
+      args+=(
+	'(-r -E)'{-r,-E}$extended
+	'-a[delay opening files listed with w function]'
+      )
+    ;|
+    darwin*|freebsd*|netbsd*)
+      args+=(
+        '-i'$inplace
+	'-l[make output line buffered]'
+      )
+    ;|
+    freebsd*) args+=( '-u[disable data buffering]' ) ;|
+    freebsd*|netbsd*)
+      args+=(
+        '-I[edit files in-place, treating all files as a single input stream]::suffix for backup'
+      )
+    ;;
+    openbsd*) args+=( '-u[make output line buffered]' ) ;;
+  esac
 fi
 
-_arguments "$args[@]"
+_arguments -s "$args[@]"
diff --git a/Completion/Unix/Command/_sort b/Completion/Unix/Command/_sort
index ff36b9b3d..2e7f0a01a 100644
--- a/Completion/Unix/Command/_sort
+++ b/Completion/Unix/Command/_sort
@@ -1,37 +1,76 @@
-#compdef sort
+#compdef sort gsort
 
+local args variant
 local ordering='(-d --dictionary-order -g --general-numeric-sort -M --month-sort -h --human-numeric-sort -n --numeric-sort --sort -V --version-sort --help --version)'
 
-_arguments -s -S \
-  '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]' \
-  "$ordering"{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]' \
-  '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]' \
-  "$ordering"{-g,--general-numeric-sort}'[compare according to general numeric value]' \
-  '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' \
-  "$ordering"{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']" \
-  "$ordering"{-h,--human-numeric-sort}'[compare human readable numbers (e.g., 2K 1G)]' \
-  "$ordering"{-n,--numeric-sort}'[compare according to string numerical value]' \
-  "$ordering"{-R,--random-sort}'[sort by random hash of keys]' \
-  '--random-source=[get random bytes from file]:file:_files' \
-  '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]' \
-  "$ordering--sort=[sort according to ordering]:ordering:(general-numeric human-numeric month numeric random version)" \
-  "$ordering"{-V,--version-sort}'[sort version numbers]' \
-  '--batch-size=[maximum inputs to merge]:number' \
-  '(-c --check -C)'{-c,-C}'[check whether input is sorted; do not sort]' \
-  '(-c --check -C)--check=-[check whether input is sorted; do not sort]::bad line handling:(diagnose-first silent quiet)' \
-  '--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)' \
-  '--debug[annotate the of the line used to sort]' \
-  '--files0-from=[read input files from file]:file:_files' \
-  '(-k --key)'{-k+,--key=}'[start a key at POS1, end it as POS2 (origin 1)]:key' \
-  '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]' \
-  '(-o --output)'{-o+,--output=}'[write result to file instead of standard output]:output file:_files' \
-  '(-s --stable)'{-s,--stable}'[preserve original order of lines with the same key]' \
-  '(-S --buffer-size)'{-S+,--buffer-size=}'[specify size for main memory buffer]:size' \
-  '(-t --field-separator)'{-t+,--field-separator=}'[specify field separator instead of non-blank to blank transition]:separator' \
-  \*{-T+,--temporary-directory=}'[specify directory for temporary files]:directory:_directories' \
-  '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]' \
-  '--parallel=[set number of sorts run concurrently]:number' \
-  '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]' \
-  '(- *)--help[display help and exit]' \
-  '(- *)--version[output version information and exit]' \
-  '*:file:_files'
+args=(
+  '(-c --check -C)-c[check whether input is sorted; do not sort]'
+  '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]'
+  '(-o --output)'{-o+,--output=}'[write result to file instead of standard output]:output file:_files'
+  \*{-T+,--temporary-directory=}'[specify directory for temporary files]:directory:_directories'
+  '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]'
+  "$ordering"{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]'
+  '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]'
+  '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]'
+  "$ordering"{-n,--numeric-sort}'[compare according to string numerical value]'
+  '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]'
+  '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]'
+  '(-t --field-separator)'{-t+,--field-separator=}'[specify field separator instead of non-blank to blank transition]:separator'
+  '(-k --key)'{-k+,--key=}'[specified start and end fields for key]:key field'
+)
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+case $variant in
+  dragonfly*|netbsd*|openbsd*|freebsd*|gnu)
+    args+=(
+      '(-s --stable)'{-s,--stable}'[preserve original order of lines with the same key]'
+    )
+  ;|
+  openbsd*|freebsd*|gnu)
+    args+=(
+      '(-c --check -C)-C[check whether input is sorted; do not sort]'
+      '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]'
+    )
+  ;|
+  freebsd*|gnu)
+    args+=(
+      '(-c --check -C)--check=-[check whether input is sorted; do not sort]::bad line handling:(diagnose-first silent quiet)'
+      "$ordering"{-g,--general-numeric-sort}'[compare according to general numeric value]'
+      "$ordering"{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']"
+      "$ordering"{-h,--human-numeric-sort}'[compare human readable numbers (e.g., 2K 1G)]'
+      "$ordering"{-R,--random-sort}'[sort by random hash of keys]'
+      "$ordering"{-V,--version-sort}'[sort version numbers]'
+      "$ordering--sort=[sort according to ordering]:ordering:(general-numeric human-numeric month numeric random version)"
+      '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]'
+      '--random-source=[get random bytes from file]:file:_files'
+      '--batch-size=[maximum inputs to merge]:number'
+      '--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)'
+      '--debug[annotate the of the line used to sort]'
+      '--files0-from=[read input files from file]:file:_files'
+      '(-S --buffer-size)'{-S+,--buffer-size=}'[specify size for main memory buffer]:size'
+      '(- *)--help[display help and exit]'
+      '(- *)--version[output version information and exit]'
+    )
+  ;|
+  netbsd*|dragonfly*)
+    args+=(
+      "${ordering}-l[sort by string length of field]"
+      "(-s)-S[don't use stable sort"
+    )
+  ;|
+  openbsd*)
+    args+=(
+      '-H[use a merge sort instead of a radix sort]'
+      '-R[specify record separator]:separator'
+    )
+  ;|
+  gnu)
+    args+=( '--parallel=[set number of sorts run concurrently]:number' )
+  ;;
+  freebsd*)
+    args+=( --radixsort  --mergesort --qsort --heapsort --mmap )
+  ;;
+  *) args=( "${(@)args:#(|\(*\))(|\*)--*}" ) ;;
+esac
+
+_arguments -s -S $args '*:file:_files'
diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname
index 9b4663b8a..414a82a87 100644
--- a/Completion/Unix/Command/_uname
+++ b/Completion/Unix/Command/_uname
@@ -1,53 +1,81 @@
 #compdef uname
 
 typeset -A _uname_args
+local -a args
+
+case $LANG in
+  de_*)
+    _uname_args=(
+      all               "alle Grundinformationen ausgeben"
+      kernel-name       "Namen des Kernels ausgeben"
+      nodename          "Netzwerknamen der Maschine ausgeben"
+      kernel-release    "Release-Nummer des Kernels ausgeben"
+      kernel-version    "Version des Kernels ausgeben"
+      os-release        "Release-Nummer des Betriebssystems ausgeben"
+      machine           "Maschinentyp (Hardware) ausgeben"
+      processor         "Typ des Prozessors ausgeben"
+      hardware-platform "Hardwareplattform ausgeben"
+      operating-system  "Namen des Betriebssystems ausgeben"
+      help              "Hilfe anzeigen und beenden"
+      version           "Versionsinformation anzeigen und beenden"
+    )
+  ;;
+  (*)
+    _uname_args=(
+      all               "print all basic information"
+      kernel-name       "print kernel name"
+      nodename          "print network node hostname"
+      kernel-release    "print kernel release"
+      kernel-version    "print kernel version"
+      os-release        "print operating system release level"
+      machine           "print machine hardware name"
+      processor         "print processor type"
+      hardware-platform "print hardware platform"
+      operating-system  "print name of the operating system"
+      help              "display help information"
+      version           "output version information and exit"
+    )
+  ;;
+esac
 
 if _pick_variant gnu="Free Soft" unix --version; then
-  case $LANG in
-    (de_DE.UTF-8)
-       _uname_args=(
-             all               "alle Informationen ausgeben"
-             kernel-name       "Namen des Kernels ausgeben"
-             nodename          "Netzwerknamen der Maschine ausgeben"
-             kernel-release    "Release-Nummer des Kernels ausgeben"
-             kernel-version    "Version des Kernels ausgeben"
-             machine           "Maschinentyp (Hardware) ausgeben"
-             processor         "Typ des Prozessors ausgeben (oder das Wort unknown)"
-             hardware-platform "Hardwareplattform ausgeben (oder das Wort unknown)"
-             operating-system  "Namen des Betriebssystems ausgeben"
-             help              "diese Hilfe anzeigen und beenden"
-             version           "Versionsinformation anzeigen und beenden"
-       )
+  _arguments -s \
+    '(-)'{--all,-a}'['$_uname_args[all]']' \
+    '(--kernel-name -s)'{--kernel-name,-s}'['$_uname_args[kernel-name]']' \
+    '(--nodename -n)'{--nodename,-n}'['$_uname_args[nodename]']' \
+    '(--kernel-release -r)'{--kernel-release,-r}'['$_uname_args[kernel-release]']' \
+    '(--kernel-version -v)'{--kernel-version,-v}'['$_uname_args[kernel-version]']' \
+    '(--machine -m)'{--machine,-m}'['$_uname_args[machine]']' \
+    '(--processor -p)'{--processor,-p}'['$_uname_args[processor]']' \
+    '(--hardware-platform -i)'{--hardware-platform,-i}'['$_uname_args[hardware-platform]']' \
+    '(--operating-system -o)'{--operating-system,-o}'['$_uname_args[operating-system]']' \
+    '(-)--help['$_uname_args[help]']' \
+    '(-)--version['$_uname_args[version]']'
+else
+  args=(
+    "(-m -n -r -s -v)-a[${_uname_args[all]}]"
+    '-m[print hardware class]'
+    "-n[${_uname_args[nodename]}]"
+    "-p[${_uname_args[processor]}]"
+    "-r[${_uname_args[os-release]}]"
+    "-s[${_uname_args[operating-system]}]"
+    '-v[print detailed operating system version]'
+  )
+  case $OSTYPE in
+    freebsd*|dragonfly*) args+=( '-i[print kernel ident]' ) ;|
+    freebsd<10->.*)
+      args+=(
+	'-K[print FreeBSD kernel version]'
+	'-U[print FreeBSD user environment version]'
+      )
     ;;
-    (*)
-       _uname_args=(
-             all               "print all information"
-             kernel-name       "print the kernel name"
-             nodename          "print the network node hostname"
-             kernel-release    "print the kernel release"
-             kernel-version    "print the kernel version"
-             machine           "print the machine hardware name"
-             processor         "print the processor type or \"unknown\""
-             hardware-platform "print the hardware platform or \"unknown\""
-             operating-system  "print the operating system"
-             help              "display this help and exit"
-             version           "output version information and exit"
-       )
+    solaris*)
+      args+=(
+        '-i[print platform name]'
+	'-S[set system name]:system name'
+        '-X[print expanded system information]'
+      )
     ;;
   esac
-
-  _arguments \
-        '(--all -a)'{--all,-a}'['$_uname_args[all]']' \
-        '(--kernel-name -s)'{--kernel-name,-s}'['$_uname_args[kernel-name]']' \
-        '(--nodename -n)'{--nodename,-n}'['$_uname_args[nodename]']' \
-        '(--kernel-release -r)'{--kernel-release,-r}'['$_uname_args[kernel-release]']' \
-        '(--kernel-version -v)'{--kernel-version,-v}'['$_uname_args[kernel-version]']' \
-        '(--machine -m)'{--machine,-m}'['$_uname_args[machine]']' \
-        '(--processor -p)'{--processor,-p}'['$_uname_args[processor]']' \
-        '(--hardware-platform -i)'{--hardware-platform,-i}'['$_uname_args[hardware-platform]']' \
-        '(--operating-system -o)'{--operating-system,-o}'['$_uname_args[operating-system]']' \
-        '--help['$_uname_args[help]']' \
-        '--version['$_uname_args[version]']'
-else
-#       TODO add options of a NON GNU implementation
+  _arguments -s $args
 fi
diff --git a/Completion/Unix/Command/_uniq b/Completion/Unix/Command/_uniq
index dcd7a6f49..1cf12357b 100644
--- a/Completion/Unix/Command/_uniq
+++ b/Completion/Unix/Command/_uniq
@@ -1,4 +1,4 @@
-#compdef uniq
+#compdef uniq guniq
 
 local args
 
@@ -20,7 +20,7 @@ args=(
 
 if ! _pick_variant gnu=Free\ Soft unix --version; then
   local optchars="cdufs"
-  if [[ "$OSTYPE" == (darwin|freebsd)* ]]; then
+  if [[ "$OSTYPE" == (darwin|dragonfly|freebsd)* ]]; then
     optchars="${optchars}i"
   fi
   args=( ${(M)args:#(|\*)(|\(*\))-[$optchars]*} )
diff --git a/Completion/Unix/Command/_wc b/Completion/Unix/Command/_wc
new file mode 100644
index 000000000..49a03ba2c
--- /dev/null
+++ b/Completion/Unix/Command/_wc
@@ -0,0 +1,26 @@
+#compdef wc gwc
+
+local args
+
+args=(
+  '(-c --bytes)'{-c,--bytes}'[print byte counts]'
+  '(-C -m --chars)'{-m,--chars}'[print character counts]'
+  '(-w --words)'{-w,--words}'[print word counts]'
+  '(-l --lines)'{-l,--lines}'[print line counts]'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  args+=(
+    '(*)--files0-from=[read NUL-terminated file list from specified file]:file:_files'
+    '(-L --max-line-length)'{-L,--max-line-length}'[print longest line lengths]'
+  )
+else
+  args=( -A "-*" "${(@)args:#(|\(*\))(|\*)--*}" )
+  case $OSTYPE in
+    freebsd*|netbsd*) args+=( '-L[print longest line lengths]' ) ;;
+    openbsd*) args+=( '-h[human readable: use unit suffixes]' ) ;;
+    solaris*) args+=( ${${(M)args:#*-m\[*}//-m\[/-C\[} ) ;;
+  esac
+fi
+
+_arguments -s -S $args '*:file:_files'
diff --git a/Completion/Unix/Command/_xargs b/Completion/Unix/Command/_xargs
index f727ed8b7..d8c0a0ec2 100644
--- a/Completion/Unix/Command/_xargs
+++ b/Completion/Unix/Command/_xargs
@@ -1,15 +1,63 @@
-#compdef xargs
-
-_arguments \
-  '(-t)-p[prompt user for each command]' \
-  '(-p)-t[verbose - echo each command]' \
-  '-x[exit if max size exceeded]' \
-  -{e-,E}':end-of-file string:' \
-  '(-x -I)-i-:replacement string for lines:' \
-  '(-x -i)-I:replacement string for lines:' \
-  '(-n -L -x)-l-:number of input lines:' \
-  '(-n -l)-L:number of input lines:' \
-  '(-l -L)-n-:maximum number of arguments:' \
-  '-s-:maximum command line length:' \
+#compdef xargs gxargs
+
+local args variant
+
+args=(
+  '(-l -L --max-lines -n --max-args -s --max-chars)'{-n+,--max-args=}'[specify maximum number of arguments for each line]:number of arguments' \
+  '(-l -L --max-lines -n --max-args -s --max-chars)'{-s+,--max-chars=}'[specify maximum characters per command line]:maximum command line length'
+  '(-p --verbose -t --interactive)'{-p,--interactive}'[prompt user for each command]'
+  '(-p --verbose -t --interactive)'{-t,--verbose}'[verbose - echo each command]'
+  '(-x --exit)'{-x,--exit}'[exit if max size exceeded]'
+)
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+
+case $variant in
+  gnu|darwin*|freebsd*|netbsd*|openbsd*)
+    args+=(
+      '(--max-procs -P)'{-P,--max-procs}'[parallel mode]:maximum processes' '!-r'
+    )
+  ;|
+  dragonfly*|darwin*|freebsd*|netbsd*|openbsd*)
+    args=( "${(@)args:#(|\(*\))(|\*)--*}"
+      '-0[expect NUL characters as input separators]'
+      '-J[specify marker for position of arguments]:marker'
+      '-R[specify maximum arguments that -I will replace in]:replacements'
+    )
+  ;|
+  freebsd*|netbsd*)
+    args+=(
+      '-S[space that -I can use for replacements]:size (bytes) [255]'
+    )
+  ;;
+  solaris*|gnu)
+    args+=(
+      '(-x -I)'{-i-,--replace}'[specify replacement string for command line]::replacement string'
+      '(-n -L -x)-l-[call program for every number of lines]:number of input lines'
+      '(-E -e --eof)'{-e-,--eof=}'[specify EOF marker]:end-of-file marker'
+    )
+  ;|
+  solaris*) args=( "${(@)args:#(|\(*\))(|\*)--*}" ) ;|
+  solaris2.<11->)
+    args+=( '-0[expect NUL characters as input separators]' )
+  ;;
+  gnu)
+    args+=(
+      '(-a --arg-file)'{-a+,--arg-file=}'[read input items from specified file]:file:_files'
+      '(-0 --null -d --delimiter)'{-0,--null}'[expect NUL characters as input separators]'
+      '(-d --delimiter -0 --null)'{-d+,--delimiter=}'[specify delimiter of input items]:delimiter'
+      '(-l -L --max-lines -n --max-args -s --max-chars)--max-lines=-[call program for every number of lines]::number of input lines'
+      '(-r --no-run-if-empty)'{-r,--no-run-if-empty}"[don't run command in absence of input]"
+      '(- *)--help[show help information]'
+      '(- *)--version[show version information]'
+      '--show-limits[show OS imposed limits to command-line length]'
+    )
+  ;;
+esac
+
+_arguments -s $args \
+  '-E[specify EOF marker]:end-of-file marker' \
+  '(-x -i)-I[specify replacement string for command line]:replacement string' \
+  '(-n -l)-L[call program for every number of lines]:number of input lines' \
   '(-):command: _command_names -e' \
   '*::args: _normal'