about summary refs log tree commit diff
path: root/Functions/Zftp/zftype
blob: 81f95deceac815e3745d48b2b41ff0c0d3d7ff26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# function zftype {
local type
[[ $curcontext = :zf* ]] || local curcontext=:zftype

zfautocheck -d

if (( $# == 0 )); then
  type=$(zftp type)
  if [[ $type = I ]]; then
    print "Current type is image (binary)"
    return 0
  elif [[ $type = A ]]; then
    print "Current type is ASCII"
    return 0
  else
    return 1
  fi
else
  if [[ $1 == (#i)a(sc(ii|)|) ]]; then
    type=A
  elif [[ $1 == (#i)i(m(age|)|) || $1 == (#i)b(in(ary|)|) ]]; then
    type=I
  else
    print "Type not recognised:  $1" 2>&1
    return 1
  fi
  zftp type $type
fi
# }