From 48525452555a24b9d41748f26b4b77f160f01220 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 1 Apr 2000 20:49:47 +0000 Subject: Updated from list as far as 10376 --- Functions/Zftp/zfcd_match | 12 +++++++----- Functions/Zftp/zfget_match | 31 ++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 16 deletions(-) (limited to 'Functions/Zftp') diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match index 67e719888..02a19af21 100644 --- a/Functions/Zftp/zfcd_match +++ b/Functions/Zftp/zfcd_match @@ -15,7 +15,7 @@ local tmpf=${TMPPREFIX}zfcm$$ if [[ $ZFTP_SYSTEM = UNIX* ]]; then # hoo, aren't we lucky: this makes things so much easier - setopt localoptions rcexpandparam + setopt rcexpandparam local dir if [[ $1 = ?*/* ]]; then dir=${1%/*} @@ -25,13 +25,15 @@ if [[ $ZFTP_SYSTEM = UNIX* ]]; then # If we're using -F, we get away with using a directory # to list, but not a glob. Don't ask me why. # I hate having to rely on awk here. - zftp ls -F $dir >$tmpf + zftp ls -LF $dir >$tmpf reply=($(awk '/\/$/ { print substr($1, 0, length($1)-1) }' $tmpf)) rm -f $tmpf - if [[ $dir = / ]]; then - reply=(${dir}$reply) + [[ -n $dir && $dir != */ ]] && dir="$dir/" + if [[ -n $WIDGET ]]; then + _all_labels directories expl 'remote directory' + compadd -S/ -q -P "$dir" - $reply elif [[ -n $dir ]]; then - reply=($dir/$reply) + reply=(${dir}$reply) fi else # I simply don't know what to do here. diff --git a/Functions/Zftp/zfget_match b/Functions/Zftp/zfget_match index 677108ede..0fe2bc06f 100644 --- a/Functions/Zftp/zfget_match +++ b/Functions/Zftp/zfget_match @@ -10,18 +10,27 @@ fi local tmpf=${TMPPREFIX}zfgm$$ if [[ $ZFTP_SYSTEM == UNIX* && $1 == */* ]]; then - # On the first argument to ls, we usually get away with a glob. - zftp ls "$1*$2" >$tmpf - reply=($(<$tmpf)) - rm -f $tmpf -else - if (( $#zftp_fcache == 0 )); then - # Always cache the current directory and use it - # even if the system is UNIX. - zftp ls >$tmpf - zftp_fcache=($(<$tmpf)) + if [[ -n $WIDGET ]]; then + local dir=${1:h} + [[ $dir = */ ]] || dir="$dir/" + zftp ls -LF $dir >$tmpf + local reply + reply=(${${${(f)"$(<$tmpf)"}##$dir}%\*}) + rm -f $tmpf + _all_labels files expl 'remote file' compadd -P $dir - $reply + else + # On the first argument to ls, we usually get away with a glob. + zftp ls "$1*$2" >$tmpf + reply=($(<$tmpf)) rm -f $tmpf fi - reply=($zftp_fcache); +else + local fcache_name + zffcache + if [[ -n $WIDGET ]]; then + _all_labels files expl 'remote file' compadd -F fignore - ${(P)fcache_name} + else + reply=(${(P)fcache_name}); + fi fi # } -- cgit 1.4.1