tty.c:NCL:_ncl_kht(): TWEAK Linux tty interaction, plus..
commite832c04a24404ebdf46876df6d983c8e3ecc5b93
authorSteffen "Daode" Nurpmeso <sdaoden@users.sf.net>
Thu, 12 Dec 2013 18:42:57 +0000 (12 19:42 +0100)
committerSteffen "Daode" Nurpmeso <sdaoden@users.sf.net>
Sat, 14 Dec 2013 23:39:25 +0000 (15 00:39 +0100)
tree57c5421f90e72cfeb73d145cd798fa9865c83800
parentd7d928da0a665411dbe055026078c1555a1005f8
tty.c:NCL:_ncl_kht(): TWEAK Linux tty interaction, plus..

On Linux the MAX_INPUT is truly 255 in that dropbear(1) and plain
TTY sessions get in real trouble if the linesize is exceeded, in
that nothing visual appears at all.

So take more care and clamp the error-replacement output more and
more until nothing but a string [ERR] remains.

Yet another real problem was that the code did yet not take any
care about the *prompt*, so that the "does-it-fit-onto-line" check
was complete nonsense!!  Since we simply put it via fputs(3) all
we can do is assume each byte in *prompt* requires two columns.

Finally, to be able to print at least some small error message if
all else fails, clamp the prompt to an allowed maximum.
extern.h
fio.c
tty.c