termios configuration/read question

Antti P Miettinen antti.p.miettinen at nokia.com
Sun Oct 8 18:52:25 UTC 2000


jennifer averett <jennifer.averett at oarcorp.com> writes:
> Is this a bug in termios or am I setting attributes incorrectly?
> I do not want any data in the stream modified by termios and
> am setting the attributes as below.  However '\r' is being changed
> to a '\n' from my input stream.  I
> 
>   termios_attr.c_lflag &= ~(ICANON|ECHO|ECHONL|ECHOK|ECHOE|ECHOPRT|ECHOCTL);
>   termios_attr.c_iflag &= ~(IXON|IXANY|IXOFF);

I'd just set the flags instead of anding off those not needed. With
the above, if ICRNL was set in c_iflag, it will remain set. I'd try
something like this:

    termios_attr.c_iflag = IGNBRK;
    termios_attr.c_oflag = 0;
    termios_attr.c_cflag = B9600;
    cfsetospeed(&termios_attr, termios_attr.c_cflag);
    cfsetispeed(&termios_attr, termios_attr.c_cflag);
    termios_attr.c_cflag |= CS8 | CREAD | CLOCAL;
    termios_attr.c_lflag = 0;

-- 
Antti P Miettinen
Nokia Networks



More information about the users mailing list