about summary refs log tree commit diff
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
parent37495a2ff7d1d07be8f945ae00de677b80a73821 (diff)
downloadzsh-e89eda2635dc338b5639c0bac9452189ecf9b730.tar.gz
zsh-e89eda2635dc338b5639c0bac9452189ecf9b730.tar.xz
zsh-e89eda2635dc338b5639c0bac9452189ecf9b730.zip
zsh-workers/7855
-rw-r--r--Doc/Zsh/zftpsys.yo5
-rw-r--r--Functions/Zftp/zfopen10
2 files changed, 11 insertions, 4 deletions
diff --git a/Doc/Zsh/zftpsys.yo b/Doc/Zsh/zftpsys.yo
index 89d39b985..b2f53810b 100644
--- a/Doc/Zsh/zftpsys.yo
+++ b/Doc/Zsh/zftpsys.yo
@@ -105,7 +105,10 @@ described below.
 Normally, the var(host), var(user) and var(password) are internally
 recorded for later re-opening, either by a tt(zfopen) with no arguments, or
 automatically (see below).  With the option `tt(-1)', no information is
-stored.
+stored.  Also, if an open command with arguments failed, the parameters
+will not be retained (and any previous parameters will also be deleted).
+A tt(zfopen) on its own, or a tt(zftopen -1), never alters the stored
+parameters.
 
 Both tt(zfopen) and tt(zfanon) (but not tt(zfparams)) understand URLs of
 the form tt(ftp://)var(host)/var(path...) as meaning to connect to the
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