termios configuration/read question

Charles-Antoine Gauthier charles.gauthier at nrc.ca
Wed Oct 11 16:07:24 UTC 2000


My understanding of the POSIX standard is that if ICRNL is set, then CR
is changed to NL regardless of the setting of ICANON (but if IGNCR is
set, the CR is dropped from the input stream).

The paragraph quote by Jennifer is taken verbatim from the standard. It
does not state that ICRNL has no effect when ICANON is not set. What it
states is that ICRNL causes CR to change to NL, and ICANON causes NL to
be recognized as an EOL.

Eric Norum wrote:
> 
> jennifer averett wrote:
> >
> > Thanks for the response,
> >
> > That works but looking at termios description I think it is incorrect
> > behavior. The iproc (termios.c) method changes the CR character
> > regardless of the  setting of  ICANON setting.  The following patch
> > should fix the problem, but I'd like to verify the functionality against the
> > POSIX specification before it is applied.
> >
> > "CR    Special character on input, which is recognized if the ICANON
> >           flag is set; it is the carriage return character. When ICANON and ICRNL are
> >           set and IGNCR is not set, this character is translated into an NL,
> >           and has the same effect as an NL character. "
> >
> 
> 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?
> 
> --
> Eric Norum                                 eric at cls.usask.ca
> Canadian Light Source                      Phone: (306) 966-6308
> University of Saskatchewan                 FAX:   (306) 966-6058
> Saskatoon, Canada.

-- 
Charles-Antoine Gauthier
Institute for Information Technology   Institut de technologie de
l'information
National Research Council of Canada    Conseil national de recherches du
Canada



More information about the users mailing list