zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: Re: man completion and zftp problem
Date: Wed, 15 Sep 1999 16:56:46 +0200	[thread overview]
Message-ID: <9909151456.AA29936@ibmth.df.unipi.it> (raw)
In-Reply-To: "Oliver Kiddle"'s message of "Wed, 15 Sep 1999 16:04:36 DFT." <37DFB584.506608BA@u.genie.co.uk>

Oliver Kiddle wrote:
> Finally, an unrelated thing which I have recently observed. If I use
> zfgoto to connect to an ftp site from my bookmarks and accidentally type
> the wrong password, the module saves my incorrect password in memory so,
> I then have to unload and reload the module before I can connect to the
> ftp site.

You can use `zfparams -' to unset the incorrect stored parameters; this has
been improved so that the function now unstores it's internal memory of the
directory etc.

But it does seem reasonable that a failed open won't leave the parameters
it used stored, whatever the error was.  I've changed it and documented
the fact.  (This should be transparent to zfgoto.)

--- Doc/Zsh/zftpsys.yo.zo	Wed Sep 15 16:50:19 1999
+++ Doc/Zsh/zftpsys.yo	Wed Sep 15 16:48:25 1999
@@ -105,7 +105,10 @@
 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
--- Functions/Zftp/zfopen.zo	Fri Sep 10 14:07:42 1999
+++ Functions/Zftp/zfopen	Wed Sep 15 16:50:32 1999
@@ -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 @@
   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

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy


      reply	other threads:[~1999-09-15 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-15 15:04 Oliver Kiddle
1999-09-15 14:56 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9909151456.AA29936@ibmth.df.unipi.it \
    --to=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).