summaryrefslogtreecommitdiff
path: root/Functions/Zftp/zfcd_match
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-25 15:43:45 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-25 15:43:45 +0000
commite8eb43fc308acb3f1a8ebada7633c097e5050e46 (patch)
tree2df36ef3c7709c7d4d3b7bdcb5761f98649859bf /Functions/Zftp/zfcd_match
parente74702b467171dbdafb56dfe354794a212e020d9 (diff)
downloadzsh-e8eb43fc308acb3f1a8ebada7633c097e5050e46.tar.gz
zsh-e8eb43fc308acb3f1a8ebada7633c097e5050e46.zip
Initial revision
Diffstat (limited to 'Functions/Zftp/zfcd_match')
-rw-r--r--Functions/Zftp/zfcd_match42
1 files changed, 42 insertions, 0 deletions
diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match
new file mode 100644
index 000000000..67e719888
--- /dev/null
+++ b/Functions/Zftp/zfcd_match
@@ -0,0 +1,42 @@
+# function zfcd_match {
+
+emulate -L zsh
+
+# see zfcd for details of this hack
+if [[ $1 = $HOME || $1 = $HOME/* ]]; then
+ 1="~${1#$HOME}"
+fi
+
+# error messages only
+local ZFTP_VERBOSE=45
+# should we redirect 2>/dev/null or let the user see it?
+
+local tmpf=${TMPPREFIX}zfcm$$
+
+if [[ $ZFTP_SYSTEM = UNIX* ]]; then
+ # hoo, aren't we lucky: this makes things so much easier
+ setopt localoptions rcexpandparam
+ local dir
+ if [[ $1 = ?*/* ]]; then
+ dir=${1%/*}
+ elif [[ $1 = /* ]]; then
+ dir=/
+ fi
+ # 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
+ reply=($(awk '/\/$/ { print substr($1, 0, length($1)-1) }' $tmpf))
+ rm -f $tmpf
+ if [[ $dir = / ]]; then
+ reply=(${dir}$reply)
+ elif [[ -n $dir ]]; then
+ reply=($dir/$reply)
+ fi
+else
+ # I simply don't know what to do here.
+ # Just use the list of files for the current directory.
+ zfget_match $*
+fi
+
+# }