Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Sep 1997 11:53:06 +0930
From:      Mike Smith <mike@smith.net.au>
To:        joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Timeout for sh(1) 'read' ?? 
Message-ID:  <199709280223.LAA03408@word.smith.net.au>
In-Reply-To: Your message of "Sat, 27 Sep 1997 16:42:50 %2B0200." <19970927164250.YQ59393@uriah.heep.sax.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> NB: pdksh only implements the last of the three features (at least my
> version)...
> 
> >        read [  -Aprs  ]  [  -d  delim]  [  -t  timeout]  [  -u
> >               unit]  [ vname?prompt ] [ vname ... ]
> 
> ....nor does it support -t timeout.
> 
> Adding -t timeout seems to be the best way to me.  ${TMOUT} is just
> confusing given the multitude of things it's going to do.

OK.  To be added are :

 -t <timeout>
 -d <default>

Such that if no input is received after <timeout> seconds, <default> 
will be returned, or the empty string if <default> is not supplied.

> Btw., if you're going to do this, please do also implement -r.  It
> seems to be mandated by Posix.2:
> 
>  By default, unless the -r option is specified, backslash (\) shall act as
>  an escape character, as described in 3.2.1.

This is more complicated; our sh currently does not exhibit this 
behaviour unless -e is specified, ie. -r is its "normal" behaviour and 
-e specifies the POSIXish escaping. 

I could do with some guidance from people likely to be bitten by this; 
is such a major change in the name of POSIX worthwhile?

mike





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709280223.LAA03408>