summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Functions/Zftp/zfcd_match8
2 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 46043a2e5..2e4d1fbdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-05-26  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* Han Pingtian: 35295: Functions/Zftp/zfcd_match: be more
+	inventive zftp directory listing.
+
 	* Eric Cook: 35292: Completion/Redhat/Command/_yum: complete
 	installation of local files.
 
diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match
index 9159f496c..d977983bf 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))