about summary refs log tree commit diff
path: root/Functions/Zftp
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-15 15:59:12 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-15 15:59:12 +0000
commite89eda2635dc338b5639c0bac9452189ecf9b730 (patch)
tree694524de061e3ebb5aac81c61e7c4b1d82a4b254 /Functions/Zftp
parent37495a2ff7d1d07be8f945ae00de677b80a73821 (diff)
downloadzsh-e89eda2635dc338b5639c0bac9452189ecf9b730.tar.gz
zsh-e89eda2635dc338b5639c0bac9452189ecf9b730.tar.xz
zsh-e89eda2635dc338b5639c0bac9452189ecf9b730.zip
zsh-workers/7855
Diffstat (limited to 'Functions/Zftp')
-rw-r--r--Functions/Zftp/zfopen10
1 files changed, 7 insertions, 3 deletions
diff --git a/Functions/Zftp/zfopen b/Functions/Zftp/zfopen
index 32b450411..7c7c945d4 100644
--- a/Functions/Zftp/zfopen
+++ b/Functions/Zftp/zfopen
@@ -7,7 +7,7 @@
 
 emulate -L zsh
 
-local opt dir opt_1
+local opt dir opt_1 setparams
 
 while getopts :1 opt; do
   [[ $opt = "?" ]] && print "zfopen: bad option: -$OPTARG" >&2 && return 1
@@ -35,9 +35,13 @@ if [[ $opt_1 = 1 ]]; then
   fi
 else
   # set parameters, but only if there was at least a host
-  (( $# > 0 )) && zfparams $*
+  (( $# > 0 )) && zfparams $* && setparams=1
   # now call with no parameters
-  zftp open || return 1
+  if ! zftp open; then
+    [[ -n $ZFTP_HOST ]] && zftp close
+    [[ -n $setparams ]] && zfparams -
+    return 1
+  fi
 fi
 
 if [[ -n $dir ]]; then