ash/stty usage

Denys Vlasenko vda.linux at googlemail.com
Thu Jun 5 01:02:39 UTC 2008


On Wednesday 04 June 2008 22:40, James Simmons wrote:
> 
> Hi!
> 
>    I'm attempting color text but I'm getting "K[37;1mTextK[31;1m". Any 
> idea what is wrong?

What do you do to get it?

> Also I'm looking to flush the tty. Currently I'm doing 
> 
> eat_extra_keys() {
>         local saved=$(stty -g)
>         stty -icanon min 1 time 1
>         cat -N > /dev/null	// Modified cat to flush the and not block if no
>         stty $saved		// data is present.
> }
> 
> Do you know of a better way?

Don't know for sure, maybe this?

int tcflush(int fd, int queue_selector);

       tcflush()  discards  data written to the object referred to by fd but not transmitted, or data received but not read,
       depending on the value of queue_selector:

       TCIFLUSH
              flushes data received but not read.

       TCOFLUSH
              flushes data written but not transmitted.

       TCIOFLUSH
              flushes both data received but not read, and data written but not transmitted.
--
vda



More information about the busybox mailing list