Mark Crispin | 4 May 19:50

Re: using Unix EOLs for MBOX mailboxes under Windows?

Newline handling on Windows was a long-time hair-puller for me.

As we all know, the Windows standard for newline is CRLF (and IMHO that is 
the correct one).  Some Windows applications do not work at all well with 
bare-LF line terminator text files.

15 years ago, I was forced to make the Windows code be able to access 
traditional UNIX files on a UNIX server via Samba (my pleas to "use IMAP" 
being disregarded for many years until it finally sunk in).  That 
requirement, thankfully, has long been abandoned but there are still 
echoes of it in the Windows code.

Then came what do you do when someone FTP's it in binary mode (rather than 
ASCII).

Then came what do you do when the file is all mixed with LF-only and CRLF 
newlines (much of which came about by the Samba requirement).

The current UNIX code aggressively strips all CRs from the file, and the 
Windows code equally aggressively inserts CRs in front of all LFs.  Both 
have to deal with the possibility of bare CRs (and both strip these).

What this all means is that "I'm not touching it".  You're welcome to hack 
your copy and pull your hair instead.  I want to keep the hair I still 
have!  ;-)

If I were you, and determined to do this project in spite of my warnings, 
I would not start with the current Windows driver 
(.../src/osdep/nt/unixnt.c).  I would start with the current UNIX code 
(.../src/osdep/unix/unix.c) and port that to Windows.
(Continue reading)


Gmane