rnews

Matt McLeod matt at boggle.org
Tue Nov 7 07:47:09 UTC 2000


Russ wibbled thus:
> Matt McLeod <matt at boggle.org> writes:
> 
> > The obvious solution to me would be to stick something in
> > ReadRemainder() to throw out any \r it finds.  My C is rusty, but I'm
> > happy to give it a go (though the result will probably not be too
> > pretty).  The "easy" way, I guess, would be to change ReadRemainder() so
> > it only ever reads a single character at a time, then look at that
> > character and junk it if it's a \r.  But presumably that would not be
> > nice for performance, so something more complicated is probably in
> > order.
> 
> Of roughly equivalent ease, and probably offering better performance
> assuming a decent stdio implementation, would be to switch from fread to
> fgets, check the second-to-last character after fgets to see if it's \r,
> and if so write a \n over it and back up the buffer pointer by one so that
> the next fgets overwrites the old \n.

Makes sense.  Just wish I'd thought of it myself -- but then I
did say that my C is *really* rusty.

> Alternately, and *possibly* better, one could fix NNTPsendarticle, which
> is what rnews eventually ends up calling, in lib/sendarticle.c so that it
> doesn't add the CR if lines already end in CRLF.  That looks like it would
> be pretty straightforward.  I'm not sure if that would end up corrupting
> articles that actually really did have a CR before their line terminator,
> though, under some suck and repost circumstances, and if so whether we
> actually care....

That'd cover other frontends too, which could be useful.  I'll
poke around and see what I can see.

BTW, inews barfs on CRLF too -- it's unable to find the Subject header.
But then the chances of inews being exposed to CRLF are pretty slim --
that should really only happen when dealing with stuff from outside.

-- 
                            Service with a capital "Bugger Off".



More information about the inn-workers mailing list