about summary refs log tree commit diff
path: root/Functions/Zftp/zfanon
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/Zftp/zfanon')
-rw-r--r--Functions/Zftp/zfanon16
1 files changed, 13 insertions, 3 deletions
diff --git a/Functions/Zftp/zfanon b/Functions/Zftp/zfanon
index d8a9d06a3..9624d48d9 100644
--- a/Functions/Zftp/zfanon
+++ b/Functions/Zftp/zfanon
@@ -2,7 +2,7 @@
 
 emulate -L zsh
 
-local opt optlist once
+local opt optlist once dir
 
 while [[ $1 = -* ]]; do
   if [[ $1 = - || $1 = -- ]]; then
@@ -61,10 +61,20 @@ if [[ -z $EMAIL_ADDR ]]; then
   print "Using $EMAIL_ADDR as anonymous FTP password."
 fi
 
+if [[ $1 = */* ]]; then
+  1=${1##ftp://}
+  dir=${1#*/}
+  1=${1%%/*}
+fi
+
 if [[ $once = 1 ]]; then
-  zftp open $1 anonymous $EMAIL_ADDR
+  zftp open $1 anonymous $EMAIL_ADDR || return 1
 else
   zftp params $1 anonymous $EMAIL_ADDR
-  zftp open
+  zftp open || return 1
+fi
+
+if [[ -n $dir ]]; then
+  zfcd $dir
 fi
 # }