From 206237c8ec4b7619d9e70a75004cd1ae1066b0a0 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 25 Apr 1999 15:43:41 +0000 Subject: zsh-3.1.5-pws-16 --- Functions/Zftp/zftype | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Functions/Zftp/zftype (limited to 'Functions/Zftp/zftype') diff --git a/Functions/Zftp/zftype b/Functions/Zftp/zftype new file mode 100644 index 000000000..c3b93b7a0 --- /dev/null +++ b/Functions/Zftp/zftype @@ -0,0 +1,30 @@ +# function zftype { +local type zftmp=${TMPPREFIX}zftype$$ + +zfautocheck -d + +if (( $# == 0 )); then + zftp type >$zftmp + type=$(<$zftmp) + rm -f $zftmp + 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 +# } -- cgit 1.4.1