* [PATCH] Try dir if ls -lF isn't supported by server
@ 2015-05-26 7:53 Han Pingtian
0 siblings, 0 replies; only message in thread
From: Han Pingtian @ 2015-05-26 7:53 UTC (permalink / raw)
To: zsh-workers
This patch try to fix two problems:
1. on some ftp server, "ls -lF" cann't show long listing format of files,
but "dir" can.
2. can be used with directories which have spaces in name
---
Functions/Zftp/zfcd_match | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match
index 9159f49..d977983 100644
--- a/Functions/Zftp/zfcd_match
+++ b/Functions/Zftp/zfcd_match
@@ -25,7 +25,13 @@ if [[ $ZFTP_SYSTEM = UNIX* ]]; then
fi
# If we're using -F, we get away with using a directory
# to list, but not a glob. Don't ask me why.
- reply=(${${(M)${(f)"$(zftp ls -lF $dir)"}:#d*}/(#b)*[[:space:]](*)\//$match[1]})
+ reply=(${(M)${(f)"$(zftp ls -lF $dir)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##\/})
+
+ # If ls -lF doesn't work, try dir ...
+ if ! (($#reply)); then
+ reply=(${(M)${(f)"$(zftp dir $dir)"}:#d([^[:space:]]##[[:space:]]##)(#c8)?##})
+ fi
+ reply=(${reply/(#b)d([^[:space:]]##[[:space:]]##)(#c8)([^\/]##)\/#/$match[2]})
# () {
# zftp ls -LF $dir >|$1
# reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $1))
--
1.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-05-26 7:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 7:53 [PATCH] Try dir if ls -lF isn't supported by server Han Pingtian
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).