zsh-workers
 help / color / mirror / code / Atom feed
0111555b6bdc4bf2abfeee87bd774b995acc82b6 blob 1631 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
#autoload
local tmp
local -a dev_tmp dpath_tmp mp_tmp mline

case "$OSTYPE" in
linux*)
  tmp=( "${(@f)$(< /proc/self/mounts)}" )
  dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
  mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
  ;;
irix*)
  tmp=( "${(@f)$(< /etc/mtab)}" )
  dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
  mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
  ;;
freebsd*|dragonfly*)
  /sbin/mount | while read mline; do
    [[ $mline[(w)1] = map ]] && continue
    dev_tmp+=( $mline[(w)1] )
    mp_tmp+=( $mline[(w)3] )
  done
;;
darwin*)
  tmp=( "${(@f)$(/sbin/mount)}" )
  dev_tmp=( "${(@)${(@)tmp%% *}:#map}" )
  mp_tmp=( "${(@)${(@)tmp#* on }%% \(*}" )
  ;;
*)
  /sbin/mount | while read mline; do
    mp_tmp+=( $mline[(w)1] )
    dev_tmp+=( $mline[(w)3] )
  done
  ;;
esac

local MATCH MBEGIN MEND
# The complicated substitution for mount point names is required because
# characters in /etc/mtab that might confuse programs reading the names
# are encoded as exactly 3 octal digits, like for example \040 for space.
# The cleaner-looking ${(g::)mp_tmp} might consume too many digits.
# Both mp_tmp and dev_tmp are derived from /etc/mtab or "mount" output.
mp_tmp=("${(@)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
dev_tmp=("${(@)dev_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
dpath_tmp=( "${(@M)dev_tmp:#/*}" )
dev_tmp=( "${(@)dev_tmp:#/*}" )

_alternative \
  'device-labels:device label:compadd -a dev_tmp' \
  'device-paths: device path:_canonical_paths -A dpath_tmp -N -M "r:|/=* r:|=*" device-paths device\ path' \
  'directories:mount point:_canonical_paths -A mp_tmp -N -M "r:|/=* r:|=*" directories mount\ point'
debug log:

solving 0111555b6 ...
found 0111555b6 in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).