delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/03/20/21:14:06

From: Bob_McGowan AT xstor DOT com (Bob McGowan)
Subject: RE: Where does the "\n" to "\r\n" conversion take place?
20 Mar 1998 21:14:06 -0800 :
Message-ID: <8B40B8756FA1D111BCB900A02495E24F0154BB.cygnus.gnu-win32@Neptune.xstor.com>
Mime-Version: 1.0
To: Earnie Boyd <earnie_boyd AT hotmail DOT com>, afn06760 AT afn DOT org
Cc: gnu-win32 AT cygnus DOT com

I cannot shed much light on how cygwin32 might do this, but for the
Microsoft compilers, if I remember correctly, this is "built in" to the
open() function.  The basic operation is \r\n to \n on input and \n to
\r\n on output for _TEXT_ files only.  If a file is opened in BINARY
mode (even if it is actually only text contents) no translation occurs
and you will see both \r and \n in the input.  So, if open() is found in
crtdll.dll then mingw32 should also have this feature.

Individual programs could be written to open a file in binary mode to
see if it uses the DOS or the UNIX line end convention and then do
something "appropriate" for what that program does (I have a win32
version of vim that does this).  So in some senses, the answer is "it
depends" and a search through the involved code may be the only way to
resolve this.

----
Bob McGowan
i'm bobmcgow at xstor dot com
Storage Dimensions, Inc.


-----Original Message-----
From: Earnie Boyd [mailto:earnie_boyd AT hotmail DOT com]
Sent: Monday, March 16, 1998 10:50 AM
To: afn06760 AT afn DOT org
Cc: gnu-win32 AT cygnus DOT com
Subject: Re: Where does the "\n" to "\r\n" conversion take place?




>Date: Sun, 15 Mar 1998 14:36:51 GMT
>From: afn06760 AT afn DOT org
>Subject: Where does the "\n" to "\r\n" conversion take place?
>To: gnu-win32 AT cygnus DOT com
>
>One thing you discover if you use cygwin with mingw32 to make the lynx
>web browser is that fputc('\n', fp) or fprintf(fp, "\n") in cygwin
>behaves like fprintf(fp, "\r\n") in mingw32.  Since cygwin can be 
set=20
>up to generate mingw32 code, this means that, somewhere outside of
>gcc, the conversion from "\n" to "\r\n" is made.  Or, that there is a
>compiler switch that causes one of the gcc overlays to make this
>conversion, and the mingw32 minimalist system doesn't use it.
>
>Anyone have information on this topic?

I don't have any specifics, but I've noticed that the default read mode 
will read \n or \r\n and the default write mode is to output \r\n.  I 
believe that this behavior is built into the crtdll.dll functions.



-        \\||//
---o0O0--Earnie--0O0o----
-earnie_boyd AT hotmail DOT com-
------ooo0O--O0ooo-------



______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
For help on using this list (especially unsubscribing), send a message
to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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