|
From: Paul <pau...@af...> - 2012-08-28 23:39:43
|
Sorry, my previous mail got sent by accident before it was completed (in case it eventually shows up on this list, it hasn't as of completing this mail). As I was saying... On Tue, 28 Aug 2012 23:34:35 +0100 Keith Marshall <kei...@us...> wrote: > On 28/08/12 22:48, Stuart Soloway wrote: > > It turns out that I was invoking the executable from the MinGW > > shell. > > I think you are confused. There is no such thing as "MinGW shell"; > I assume you mean the MSYS shell. If I look in the Start menu on my computer, under MinGW is "MinGW Shell", which of course launches the MSYS shell. Can't blame people for calling it what's written on the box. Dunno, maybe current versions have changed this, but I'm guessing enough people still see this. Incidentally, this may also be part of the reason for the continuous confusion over MSYS vs. MinGW that people seem to have. > > When invoked that way, it uses Linux line-termination. But if I > > invoke it from the Windows command line it uses Windows line > > termination. > > Is this a native Windows build, compiled with the MinGW compiler? > If so, then it does no such thing; it writes \r\n regardless of > which shell you launch it from. > > See, here's a thing about text mode files, written and subsequently > read back using *Microsoft's* MSVCRT.DLL I/O, (which is what MinGW > uses): when writing, \n is converted to \r\n; when reading, \r\n is > converted back to \n. I'm not sure I get this, he said he tested with emacs, so surely emacs is reporting what is actually in the file, just like od does? Or does emacs also read it in in text mode, using MSVCRT.DLL? Then surely notepad does as well? If so, how does MSVCRT.DLL know when to convert \r\n to \n, and when not to? Because it sure doesn't do it for all files. I know I've seen many files in notepad that have proper \r\n line endings. Also, why would it seem to be different based on which shell he launches the test program from? > It isn't. Not in the way you seem to think. You are confused. Actually, he seems to be asking the right questions, and the conclusions he is drawing from his investigations seem perfectly valid with the results he is observing. Paul |