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

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Date: Mon, 13 Feb 2012 14:42:34 -0500
From: John Cowan <cowan AT mercury DOT ccil DOT org>
To: Paolo Bonzini <bonzini AT gnu DOT org>
Cc: cygwin AT cygwin DOT com, bug-sed AT gnu DOT org
Subject: Re: sed strips CRs
Message-ID: <20120213194234.GA4177@mercury.ccil.org>
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>
MIME-Version: 1.0
In-Reply-To: <4F392ABC.1040309@gnu.org>
User-Agent: Mutt/1.5.18 (2008-05-17)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

Paolo Bonzini scripsit:

> 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.
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.

-- 
You annoy me, Rattray!  You disgust me!         John Cowan
You irritate me unspeakably!  Thank Heaven,     cowan AT ccil DOT org
I am a man of equable temper, or I should       http://www.ccil.org/~cowan
scarcely be able to contain myself before
your mocking visage.            --Stalky imitating Macrea

--
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