From: invalid@invalid.invalid   
      
   Lew Pitcher writes:   
   > On Tue, 20 Feb 2024 14:51:15 +0800, Paul Edwards wrote:   
   >> Cygwin has an O_TEXT on the open() call to let   
   >> "the OS layer" (can be quibbled) that the file   
   >> is being opened in text mode. And as such, it   
   >> gives that layer an opportunity to insert CRs.   
   > [snip]   
   >> I'd like to add an O_TEXT flag to Linux.[snip]   
   >> Any suggestions?   
   >   
   > Yes, one. Dont.   
   >   
   > Microsoft Windows (on top of which Cygwin must run) makes a low-level   
   > distinction between "binary" files and "text" files. I believe it is   
   > because Windows guarantees (or must guarantee) certain data   
   > transformations on text that do not apply to other forms of data.   
   > (I.e. translating sequences into C newline characters, etc)   
      
   AFAIK it’s not that low level. I can see no sign of it in CreateFile,   
   ReadFile, etc, which are approximately equivalent to open(), read() etc   
   in the Windows API. I think the implementation is in the C runtime   
   (effectively the Libc).   
      
   Cygwin does not appear rely on Windows for the implementation of its   
   O_TEXT and O_BINARY - you can see the translation code in   
   fhandler_base::read.   
      
   --   
   https://www.greenend.org.uk/rjk/   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|