summaryrefslogtreecommitdiffstats
path: root/Functions/Zftp/zfopen
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-08-01 14:48:28 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-08-01 14:48:28 +0000
commit61e68d70da5af5afe943f92cd94a8c96e78348d9 (patch)
tree1e88adbfc21452caedcb57af2880097a349f44e6 /Functions/Zftp/zfopen
parentzsh-3.1.6-test-3 (diff)
downloadzsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.tar
zsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.tar.gz
zsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.tar.bz2
zsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.tar.lz
zsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.tar.xz
zsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.tar.zst
zsh-61e68d70da5af5afe943f92cd94a8c96e78348d9.zip
Diffstat (limited to 'Functions/Zftp/zfopen')
-rw-r--r--Functions/Zftp/zfopen16
1 files changed, 13 insertions, 3 deletions
diff --git a/Functions/Zftp/zfopen b/Functions/Zftp/zfopen
index fa9b4f81d..b264aeaba 100644
--- a/Functions/Zftp/zfopen
+++ b/Functions/Zftp/zfopen
@@ -7,7 +7,7 @@
emulate -L zsh
-local optlist opt once
+local optlist opt once dir
while [[ $1 = -* ]]; do
if [[ $1 = - || $1 = -- ]]; then
@@ -31,12 +31,22 @@ done
# both .netrc and .ncftp/bookmarks . We could even try saving
# the info in their for new hosts, like ncftp does.
+if [[ $1 = */* ]]; then
+ 1=${1##ftp://}
+ dir=${1#*/}
+ 1=${1%%/*}
+fi
+
if [[ $once = 1 ]]; then
- zftp open $*
+ zftp open $* || return 1
else
# set parameters, but only if there was at least a host
(( $# > 0 )) && zfparams $*
# now call with no parameters
- zftp open
+ zftp open || return 1
+fi
+
+if [[ -n $dir ]]; then
+ zfcd $dir
fi
# }