1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +02:00

18908: use print/read -u in completion system and tweak builtin doc

This commit is contained in:
Peter Stephenson 2003-07-25 10:53:44 +00:00
parent adf2c2a0b6
commit 0f080f741c
6 changed files with 16 additions and 9 deletions

View file

@ -1,3 +1,10 @@
2003-07-25 Peter Stephenson <pws@csr.com>
* 18908: Doc/Zsh/builtins.yo, Functions/TCP/tcp_fd_handler,
Functions/TCP/tcp_read, Functions/TCP/tcp_send,
Functions/TCP/tcp_sess: Use print/read -u for supplying fd's.
Tweak documentation for print/read -u for consistency.
2003-07-24 Oliver Kiddle <opk@zsh.org> 2003-07-24 Oliver Kiddle <opk@zsh.org>
* 18901: baptiste daroussin (and Nikolai Weibull, 18894): * 18901: baptiste daroussin (and Nikolai Weibull, 18894):

View file

@ -657,7 +657,7 @@ If the tt(PUSHD_MINUS) option is set, the meanings of `tt(PLUS())' and
`tt(-)' in this context are swapped. `tt(-)' in this context are swapped.
) )
findex(print) findex(print)
xitem(tt(print) [ tt(-abcDilmnNoOpPrsz) ] [ tt(-u)var(n) ] [ tt(-f) var(format) ] [ tt(-C) var(cols) ]) xitem(tt(print) [ tt(-abcDilmnNoOpPrsz) ] [ tt(-u) var(n) ] [ tt(-f) var(format) ] [ tt(-C) var(cols) ])
item( [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])( item( [ tt(-R) [ tt(-en) ]] [ var(arg) ... ])(
With the `tt(-f)' option the arguments are printed as described by tt(printf). With the `tt(-f)' option the arguments are printed as described by tt(printf).
With no flags or with the flag `tt(-)', the arguments are printed on With no flags or with the flag `tt(-)', the arguments are printed on
@ -738,7 +738,7 @@ tt(-R); all other arguments and options are printed.
item(tt(-s))( item(tt(-s))(
Place the results in the history list instead of on the standard output. Place the results in the history list instead of on the standard output.
) )
item(tt(-u)var(n))( item(tt(-u) var(n))(
Print the arguments to file descriptor var(n). Print the arguments to file descriptor var(n).
) )
item(tt(-z))( item(tt(-z))(
@ -827,7 +827,7 @@ alias(r)(fc -e -)
findex(read) findex(read)
vindex(IFS, use of) vindex(IFS, use of)
ifzman(xitem(tt(read) [ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ])) ifzman(xitem(tt(read) [ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ]))
item(ifnzman(tt(read) [ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ]) [ tt(-u)var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])( item(ifnzman(tt(read) [ tt(-rszpqAclneE) ] [ tt(-t) [ var(num) ] ] [ tt(-k) [ var(num) ] ] [ tt(-d) var(delim) ]) [ tt(-u) var(n) ] [ var(name)[tt(?)var(prompt)] ] [ var(name) ... ])(
vindex(REPLY, use of) vindex(REPLY, use of)
vindex(reply, use of) vindex(reply, use of)
Read one line and break it into fields using the characters Read one line and break it into fields using the characters
@ -895,7 +895,7 @@ read. Note that the command name is word number 1, not word 0,
and that when the cursor is at the end of the line, its character and that when the cursor is at the end of the line, its character
index is the length of the line plus one. index is the length of the line plus one.
) )
item(tt(-u)var(n))( item(tt(-u) var(n))(
Input is read from file descriptor var(n). Input is read from file descriptor var(n).
) )
item(tt(-p))( item(tt(-p))(

View file

@ -20,14 +20,14 @@ else
zle -I zle -I
# Handle fds not in the TCP set similarly. # Handle fds not in the TCP set similarly.
# This does the drain thing, to try and get as much data out as possible. # This does the drain thing, to try and get as much data out as possible.
if ! read line <&$1; then if ! read -u $1 line; then
print "[Reading on $1 failed; removing from poll list]" >& 2 print "[Reading on $1 failed; removing from poll list]" >& 2
zle -F $1 zle -F $1
return 1 return 1
fi fi
line="fd$1:$line" line="fd$1:$line"
local newline local newline
while read -t newline <&$1; do while read -u $1 -t newline; do
line="${line} line="${line}
fd$1:$newline" fd$1:$newline"
done done

View file

@ -190,7 +190,7 @@ while (( ${#read_fds} )); do
print "[tcp_read: returned fds ${reply}]" >&2 print "[tcp_read: returned fds ${reply}]" >&2
fi fi
for read_fd in ${reply[2,-1]}; do for read_fd in ${reply[2,-1]}; do
if ! read -r line <&$read_fd; then if ! read -u $read_fd -r line; then
unset "read_fds[$read_fd]" unset "read_fds[$read_fd]"
stat=1 stat=1
continue continue

View file

@ -62,7 +62,7 @@ for TCP_SESS in $sessions; do
mystat=1 mystat=1
continue continue
fi fi
print $nonewline -r -- $* >&$fd print -u $fd $nonewline -r -- $*
if [[ $? -ne 0 || -n $TCP_FD_CLOSED ]]; then if [[ $? -ne 0 || -n $TCP_FD_CLOSED ]]; then
print "Session ${TCP_SESS}: fd $fd unusable." >&2 print "Session ${TCP_SESS}: fd $fd unusable." >&2
unset TCP_FD_CLOSED unset TCP_FD_CLOSED

View file

@ -33,7 +33,7 @@ for name in ${(ko)tcp_by_name}; do
else else
cur= cur=
fi fi
print "sess:$name; fd:$fd$cur" >&$__myfd print -u $__myfd "sess:$name; fd:$fd$cur"
done done
return $(( __myfd - 1 )) return $(( __myfd - 1 ))