Re: sed strips CRs

Paolo Bonzini <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs,gmane.os.cygwin
Message-ID <[email protected]>
On 02/13/2012 08:42 PM, John Cowan wrote:
>> > By the way, I'm still opening the script file with "rt".  I cannot think
>> > of any case when you would want to keep CRs there.
> You wouldn't, but the point is that "rt" isn't defined on Posix systems.
> If it happens to be the same as "r", good, but that isn't guaranteed.

Yes, I added a configure-time check too.  I assume that if "rt" works, 
it can be used instead of "r".

> And the only time "rt" does anything different from "r" on a Win32 system
> is when you have:
>
> 1) linked your executable with the system-supplied 'binmode.obj' file
>
> 2) set the global variable _fmode to O_BINARY
>
> 3) invoked _set_fmode(O_BINARY)
>
> all of which make "r" synonymous with "rb".  Programs which don't do any
> of these should use "r" rather than "rt", as it is guaranteed to do the
> right thing for text on both Win32 and Posix systems.

No, "rt" also does something different than "r" on Cygwin with 
binary-mounts.

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.

Paolo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.