sed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed+windows/cygwin+newlines: improving documentation


From: Assaf Gordon
Subject: Re: sed+windows/cygwin+newlines: improving documentation
Date: Tue, 9 Oct 2018 13:59:29 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 09/10/18 01:42 PM, Eli Zaretskii wrote:
Cc: Eric Blake <address@hidden>, Eli Zaretskii <address@hidden>
From: Assaf Gordon <address@hidden>
Date: Tue, 9 Oct 2018 13:03:15 -0600

The one strange exception is:
1. mingw binary
2. reading from a file (not pipe or redirection)
3. using "-b"
Then, upon *reading*, only LF (\n) are counted,
while CR (\r) are treated like just another character (like in unix).
But when writing, it still adds CR+LF (and converts LF-only input to
CRLF output).


Based on the code, I thought it would also create files
with only "LF" when using in-place file output, but I couldn't make it
work.

I just skimmed the recent sources, but according to what I see, it
sounds like -b only affects writing with the 'w' and 'W' commands, I
don't see where Sed switches its standard output to binary mode.  Did
I miss something?

Correct, with the addition of -i/--inplace option should also respect
the write_mode when the temporary file is created:
https://opengrok.housegordon.com/source/xref/sed/sed/execute.c#617

STDOUT is not affected in any case.

-assaf






reply via email to

[Prev in Thread] Current Thread [Next in Thread]