termios configuration/read question

Antti P Miettinen antti.p.miettinen at nokia.com
Wed Oct 11 16:50:05 UTC 2000


Eric Norum <eric at cls.usask.ca> writes:
> What documentation are you working from?  
> 
> The termios man page on Linux makes no mention about ICRNL being
> effective only when ICANON is set.  I lifted the code in question from
> FreeBSD so I assumed that it was doing the right thing.  The Linux code
> seems to do ICRNL processing whether or not ICANON is set.
> 
> Is this yet another change from the POSIX folks?  If so, is it better to
> track POSIX or to work the way that FreeBSD and Linux do?

I do not have POSIX standards handy now but HPUX termios manual page
(which refers to POSIX.1 in STANDARDS CONFORMANCE) says:

         CR             (ASCII CR) special character on input is recognized
                        if ICANON is enabled.  When ICANON and ICRNL are
                        enabled and IGNCR is not enabled, this character is
                        translated into a NL, and has the same affect as the
                        NL character.  If ICANON and IGNCR are enabled, the
                        CR character is ignored.  If ICANON is enabled and
                        both ICRNL and IGNCR are not enabled, the CR
                        character is treated as a normal data character.

I would say that this leaves behaviour undefined when ICANON is not
set but ICRNL is. I think the current behaviour follows the principle
of least surprise.

-- 
Antti P Miettinen
Nokia Networks



More information about the users mailing list