you can check if any ast command has an option that matches a prefix by
thecommand --?theprefix
in this case
stty --?fd
and for ast stty (beta src to be posted today) you get
OPTIONS
-f, --fd=fd Use fd as the terminal fd. The default value is 0.
the libcmd RELEASE file shows this changed 2010-04-01
to verify
stty --?-version
produces
version stty (AT&T Research) 2010-04-01
On Thu, 27 May 2010 10:37:54 +0200 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= wrote:
> Yves, AST stty has no --fd option.
> Olga
> On Thu, May 27, 2010 at 10:21 AM, Yves Crespin <[email protected]>
> wrote:
> > Hello Roland,
> >
> > stdin is a terminal, you must set echo off (stty -echo).
> > I made few changes to deal with end of line and to be able to test it.
> >
> > Because you are reading caracters one by one, you are in a raw mode.
> > So you must deal with end-of-file.
> >
> > And ... I hard-code Ctrl-D as EOF.
> > I can get eof from stty, like :
> > eof=$(stty -a | sed -n 's/eof = \([^;]*\);.*/\1/p')
> > But after, I need to change ^D to $'\cd' and I don't know how to do it!!
> >
> > Regards,
> >
> > Yves
> >
> > -- snip --
> > #!/bin/ksh
> > set -u
> > # 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 read -u $fd -N 1 ch ; do
> > if [[ $ch == +($'\n'|$'\r'|$'\cd') ]]; then
> > var=${_.buf}
> > _.reset
> > [[ $var == '' ]] && return 1
> > return 0
> > fi
> > _.buf+=$ch
> > done
> >
> > return 1
> > }
> > )
> >
> > integer infd
> > linebuf_t clientbuf
> >
> > redirect {infd}< '/dev/stdin'
> > stty --fd=$infd -echo
> >
> > trap 'stty --fd=$infd echo' EXIT
> >
> > while clientbuf.readbuf line $infd ; do
> > printf $"client: %q\n" "$line"
> > printf '%s\n' "$line" >&$infd
> > done
> > # End Of File
> > -- snip --
> >
> >
> > yves crespin
> >
> > On Wed, May 26, 2010 at 10:04 PM, Roland Mainz <[email protected]>
> > wrote:
> >>
> >> 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
> >>
> >
> > _______________________________________________
> > ast-users mailing list
> > [email protected]
> > https://mailman.research.att.com/mailman/listinfo/ast-users
> >
> --
> , _ _ ,
> { \/`o;====- Olga Kryzhanovska -====;o`\/ }
> .----'-/`-/ [email protected] \-`\-'----.
> `'-..-| / http://twitter.com/fleyta \ |-..-'`
> /\/\ Solaris/BSD//C/C++ programmer /\/\
> `--` `--`
> _______________________________________________
> ast-users mailing list
> [email protected]
> https://mailman.research.att.com/mailman/listinfo/ast-users
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users