CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts
Brian Inglis
Brian.Inglis@SystematicSw.ab.ca
Tue Jun 13 17:34:00 GMT 2017
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
More information about the Cygwin
mailing list