delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/13/14:49:15

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Message-ID: <4F39691C.1030807@gnu.org>
Date: Mon, 13 Feb 2012 20:48:44 +0100
From: Paolo Bonzini <bonzini AT gnu DOT org>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0
MIME-Version: 1.0
To: John Cowan <cowan AT mercury DOT ccil DOT org>
CC: cygwin AT cygwin DOT com, bug-sed AT gnu DOT org
Subject: Re: sed strips CRs
References: <2BF01EB27B56CC478AD6E5A0A28931F203F560E4 AT A1DAL1SWPES19MB DOT ams DOT acs-inc DOT net> <20120210150708 DOT GA22832 AT calimero DOT vinschen DOT de> <CA+sc5m=UkJRKK9WZCvcfsetSUc_CHkGC-gFZEher3Tg=fK=RkQ AT mail DOT gmail DOT com> <20120211100600 DOT GA9823 AT calimero DOT vinschen DOT de> <CA+sc5mmnMBjBAqsuUdddEEwE5pgBDiGDkeV-H0WvEyZO08dMNA AT mail DOT gmail DOT com> <4F391A38 DOT 6000505 AT redhat DOT com> <4F392012 DOT 80101 AT gnu DOT org> <20120213145612 DOT GA8858 AT calimero DOT vinschen DOT de> <4F392ABC DOT 1040309 AT gnu DOT org> <20120213194234 DOT GA4177 AT mercury DOT ccil DOT org>
In-Reply-To: <20120213194234.GA4177@mercury.ccil.org>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019