* [Patch] remove awk dependency from zfcd_match
@ 2009-09-12 12:14 Baptiste Daroussin
0 siblings, 0 replies; only message in thread
From: Baptiste Daroussin @ 2009-09-12 12:14 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 203 bytes --]
Hi
here comes a patch that remove the awk dependency from zfcd_match (in Zftp).
1/ no awk needed
2/ it know works on freebsd and openbsd (Only I tested on both) it
wasn't the case before.
regards,
Bapt
[-- Attachment #2: zfcd_match-noawk.patch --]
[-- Type: application/octet-stream, Size: 963 bytes --]
diff --git a/Functions/Zftp/zfcd_match b/Functions/Zftp/zfcd_match
index e034ca0..2afeabd 100644
--- a/Functions/Zftp/zfcd_match
+++ b/Functions/Zftp/zfcd_match
@@ -1,6 +1,7 @@
# function zfcd_match {
emulate -L zsh
+setopt extendedglob
# see zfcd for details of this hack
if [[ $1 = $HOME || $1 = $HOME/* ]]; then
@@ -25,9 +26,10 @@ 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 -LF $dir >$tmpf
- reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $tmpf))
- rm -f $tmpf
+ reply=(${${(M)${(f)"$(zftp ls -lF $dir)"}:#d*}/(#b)*[[:space:]](*)\//$match[1]})
+# zftp ls -LF $dir >$tmpf
+# reply=($(awk '/\/$/ { print substr($1, 1, length($1)-1) }' $tmpf))
+# rm -f $tmpf
[[ -n $dir && $dir != */ ]] && dir="$dir/"
if [[ -n $WIDGET ]]; then
_wanted directories expl 'remote directory' \
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-12 12:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-12 12:14 [Patch] remove awk dependency from zfcd_match Baptiste Daroussin
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).