X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=OeGdg0/28GgmzZC8 NA33AsnV6PxQXr4hsU/k4nSnyccAsvrcqk0vQRaq4jyoCA9N87aWJUH1hLJrtEgK gS0jwTqYKWOBfQWaE/W+y/+K7dIK2JrOV0fJPW+yTpVslWM7q5nUOGYp2r1Idp5a jWhRcHyAA+KgC9O81LGb6waokrA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=kQGdLfDpYUEY6/jjFbeiAN fz3xA=; b=u7Xq1nk8fqCNNNARPX4polBfcUAgIg0Xykqb1qkDCS/2JSYvmnHUUe B9wRkjsKznXTmhqx0BSAx5t72xHPPlkACspJ1MJpytsFyh5pE3hVukzEvyamLItY qAhBCB3bMbMC1p2hq9OKZ1KDJuVgEaPnNTSuR81AjmzIc9BTBl/nc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=inglis, alberta, Inglis, Alberta X-HELO: smtp-out-so.shaw.ca X-Authority-Analysis: v=2.2 cv=UpATD64B c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=dTgijWl_AAAA:8 a=uPZiAMpXAAAA:8 a=aUIYxUqHsIvjZbp6NgAA:9 a=QEXdDO2ut3YA:10 Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts To: cygwin AT cygwin DOT com References: <0F7D3B1B3C4B894D824F5B822E3E5A175B2636E4 AT IRSMSX103 DOT ger DOT corp DOT intel DOT com> <0F7D3B1B3C4B894D824F5B822E3E5A175B26CE47 AT IRSMSX102 DOT ger DOT corp DOT intel DOT com> <59399CC5 DOT 60900 AT tlinx DOT org> <417f84ac-5d9f-dc50-e912-973e90b8a128 AT redhat DOT com> <0F7D3B1B3C4B894D824F5B822E3E5A175B26F278 AT IRSMSX102 DOT ger DOT corp DOT intel DOT com> <34b26965-34c2-b5f0-a3f2-b2c3df344b08 AT gmail DOT com> <0F7D3B1B3C4B894D824F5B822E3E5A175B270518 AT IRSMSX102 DOT ger DOT corp DOT intel DOT com> <5313de97-d9bd-d9c9-cb4a-254a3eadcf4a AT redhat DOT com> <3100fec0-bed0-f2fd-fe3c-11e5580d80f0 AT redhat DOT com> From: Brian Inglis Message-ID: Date: Tue, 13 Jun 2017 11:34:35 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfIhxeHXMgWDWTfChgIVIAYv78B3tk8ncnw16wFEQ320CTrBL8Ptij9fKSSmysY5XrhnNxZiF3629dpv0g2hZWRUMrRKfZzaKRW4gG1RTm/b4iAfyDpL3 yR3cpe1sP1OvfvGgt2PddUJKXCYE5tF89bFl1J/44KxFLlj732tnaFpYS79kLPEr01BvXrKgdLf/eg== X-IsSubscribed: yes On 2017-06-13 08:11, cyg Simple wrote: > On 6/10/2017 10:30 PM, Eric Blake wrote: >> On 06/10/2017 08:48 AM, cyg Simple wrote: >>> Uhm, 'wt' and 'wb' came from MS itself. >> Not quite. fopen(,"wb") comes from POSIX. "wt" is probably a microsoft >> extension, but it is certainly not in POSIX nor in glibc. > I think it's a C standard so it should be in glibc. It may be mentioned > in the POSIX standard as in support of the C standard. >>> GNU GCC was adapted to allow it >> Huh? It's not whether the compiler allows it, but whether libc allows >> it. ALL libc that are remotely close to POSIX compliant support >> fopen(,"wb"), but only Windows platforms (and NOT glibc) support >> fopen(,"wt"). > Looking at http://www.cplusplus.com/reference/cstdio/fopen/ I see: > "If additional characters follow the sequence, the behavior depends on > the library implementation: some implementations may ignore additional > characters so that for example an additional "t" (sometimes used to > explicitly state a text file) is accepted." > There is also a lot of discussion about the topic at: > https://stackoverflow.com/questions/229924/difference-between-files-writen-in-binary-and-text-mode > As for glibc, it will just ignore the extra character but it allows the > use of "wt"; it just means nothing to that C runtime library. It does > aide in portable code though. > As for me conflating GCC with a C runtime - please forgive my lapse in > memory. There's no need for open mode "t", as text is the default mode unless "b" is specified, and assuming you use "cooked" line I/O functions like fgets/fputs, not "raw" binary I/O like fread/fwrite; fscanf ignores all line terminators unless you use formats like "%c" which could see them. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- 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