Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: 3.1.6: "read -k" doc (Re: coproc tutorial (Re: questions))



On Oct 11, 12:45pm, Sven Wischnowsky wrote:
} Subject: Re: coproc tutorial (Re: questions)
}
} 3.1.6-pws-something (at least the latest pws-6) has Functions/Misc/nslookup

And Functions/Misc/nslookup has the misconception that "read -k1" reads
one byte, which it does, but only by accident: "read -k8192" reads one
byte as well.

If even Sven is confused, I guess this does need a doc patch.

Index: Doc/Zsh/builtins.yo
===================================================================
@@ -713,6 +713,9 @@
 var(name), without word splitting.  This flag is ignored when tt(-q) is
 present.  Input is read from the terminal unless one of tt(-u) or tt(-p)
 is present.  This option may also be used within zle widgets.
+
+Note that var(num) must be in the argument word that follows tt(-k), not
+in the same word.  See tt(-u).
 )
 item(tt(-z))(
 Read one entry from the editor buffer stack and assign it to the first
@@ -749,7 +752,8 @@
 index is the length of the line plus one.
 )
 item(tt(-u)var(n))(
-Input is read from file descriptor var(n).
+Input is read from file descriptor var(n), where var(n) is a single
+digit and must em(not) be separated from tt(-u) by any whitespace.
 )
 item(tt(-p))(
 Input is read from the coprocess.
Index: Functions/Misc/nslookup
===================================================================
@@ -10,7 +10,7 @@
 coproc command nslookup
 pid=$!
 
-while read -pk1 char; do
+while read -pk 1 char; do
   line="$line$char"
   [[ "$line" = *'
 > ' ]] && break
@@ -21,7 +21,7 @@
 while vared -p '> ' line; do
   print -p "$line"
   line=''
-  while read -pk1 char; do
+  while read -pk 1 char; do
     line="$line$char"
     [[ "$line" = *'
 > ' ]] && break

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author