Hi!
----
Does anyone know why the example below echos the characters I type _twice_ ?
-- snip --
# line buffer class
# The buffer class tries to read characters from the given <fd> until
# it has read a whole line.
typeset -T linebuf_t=(
typeset buf
function reset
{
_.buf=''
return 0
}
function readbuf
{
nameref var=$1
integer fd=$2
typeset ch
while IFS='' read -u${fd} -t 0.2 -N 1 ch ; do
[[ "${ch}" == $'\r' ]] && continue
if [[ "${ch}" == $'\n' ]] ; then
var="${_.buf}"
_.reset
return 0
fi
_.buf+="$ch"
done
return 1
}
)
redirect {infd}< '/dev/stdin'
linebuf_t clientbuf
for (( ;; )) ; do
while clientbuf.readbuf line ${infd} ; do
printf $"client: %q\n" "${line}"
printf '%s\n' "${line}" >&${fd}
done
done
-- snip --
If I run this script and enter "FISH" I get:
FFIISSHH
Erm... why does this happen ?
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [email protected]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 3992797
(;O/ \/ \O;)
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users