This is the mail archive of the
mailing list for the Cygwin project.
Re: sed strips CRs
On Mon, Feb 13, 2012 at 2:48 PM, Paolo Bonzini wrote:
> If you meant that "rt" should be restricted to cygwin, that's also fine by
> me but in general I prefer feature tests to OS tests.
Then it becomes Cygwin's problem. I'm going to quote from
Open in text (translated) mode. In this mode, CTRL+Z is interpreted as
an EOF character on input. In files that are opened for
reading/writing by using "a+", fopen checks for a CTRL+Z at the end of
the file and removes it, if possible. This is done because using fseek
and ftell to move within a file that ends with CTRL+Z may cause fseek
to behave incorrectly near the end of the file.
In text mode, carriage returnâlinefeed combinations are translated
into single linefeeds on input, and linefeed characters are translated
to carriage returnâlinefeed combinations on output. When a Unicode
stream-I/O function operates in text mode (the default), the source or
destination stream is assumed to be a sequence of multibyte
characters. Therefore, the Unicode stream-input functions convert
multibyte characters to wide characters (as if by a call to the mbtowc
function). For the same reason, the Unicode stream-output functions
convert wide characters to multibyte characters (as if by a call to
the wctomb function).
So does Cygwin really want to specify "rt"? I would rather sed
specify "rb" and treat the CR as white space. I know that treating CR
as white space works well.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple