[links-list] Downloaded files are not in binary mode
mikulas at artax.karlin.mff.cuni.cz
Mon Jun 4 05:21:48 PDT 2001
> > > I'm running links using Cygwin under WinNT (it compiles and runs just
> > > fine, ./configure gets all the right options etc.). However, Cygwin
> > > defaults file operations to text mode which on Win systems gives \r\n as
> > > end of line. This is fine for configuration files, HTML and the like,
> > > but when a file is opened for download it also defaults to text mode and
> > > gets corrupted (as per the ANSI C standard).
> > >
> > > The solution is the following patch, to do the open with O_BINARY and
> > > force binary mode. I've enclosed it in a #ifdef for Cygwin, but it can
> > > probably by made standard (I think, but am not certain, that O_BINARY is
> > > a valid flag even on Unix systems which are always binary).
> > I use set_bin function to set binary mode for file. Please try to fix this
> > function instead. There are more places where links is opening files, they
> > all are using set_bin and it would be better to fix it there.
> OK, I see the problem. Cygwin gcc sets both UNIX and WIN32 variables
> (and wants to use 'real' pipes but alse setmode to binary). The
> following patch does this:
The rest of the code is written with assumption that exactly one of OS2,
WIN32, BEOS, UNIX macros is defined, so it would be best to undefine UNIX
or change it to something not conflicting.
BTW. does Cygwin have threads? Would it be possible to use them? Links is
forking to do lookups and to wait for user viewers and I guess WIN32
doesn't have copy-on-write.
links-list mailing list
links-list at appwatch.com
More information about the links-list