JonY wrote:
Setting to stdin and stdout implicitly to binary mode at the beginning of main solved the problems. Something like:

 int main( const int argc, const char * const argv[] )
   {
+  setmode(STDIN_FILENO, O_BINARY);
+  setmode(STDOUT_FILENO, O_BINARY);

Thanks. I have already uploaded rc3. I'll announce it tomorrow.


setmode looks to be available with OS/2 as well, but its unrelated to BSD setmode.

Is there some "setmode" function common to Windows and OS/2? OS/2 seems to use this:

+#ifdef __EMX__
+  _fsetmode( stdin, "b");
+  _fsetmode( stdout, "b");
+#endif


I would consider adding a conditional for binary mode stdin/stdout, but not litter the code with a conditional per system. Text mode is a bug[1], not a feature.

[1] http://cygwin.com/faq.html
"Actually there's no really good reason to do text mode processing since it only slows down reading and writing files".


There are some minor issues for win32 too, it doesn't have fchmod() and fchown() and some other permission related macros. How should these be dealt with in the long term?

In the short term I expect packagers to comment them out. ;-)

In the medium term I expect most "posix-like environments" (Cygwin, MinGW) for non-posix systems will implement[2] (or at least fake) them.

[2] http://en.wikipedia.org/wiki/MinGW#Comparison_with_Cygwin
"Cygwin aims to provide a complete POSIX layer (similar to that found in a Linux or other Unix systems) on top of Windows, sacrificing performance where necessary for compatibility".

In the long term I hope non-posix systems will become posix-systems or dissapear.

But suggestions are welcome. :-)


Best regards,
Antonio.


_______________________________________________
Lzip-bug mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lzip-bug

Reply via email to