about summary refs log tree commit diff
path: root/Functions/Zftp/zfopen
diff options
context:
space:
mode:
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
 # }